User Tools

Site Tools

한국어

comfilepi:create_a_linux_project:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
comfilepi:create_a_linux_project:index [2023/01/25 14:33]
COMFILE Technology [Specify the Library Depenencies in the Project's Properties]
comfilepi:create_a_linux_project:index [2023/03/13 13:27] (current)
COMFILE Technology [Specify the Library Depenencies in the Project's Properties]
Line 4: Line 4:
  
 This method can be used for much more than console applications,​ including Qt, GTK+, and even OpenGL to name a few.  The demonstration that follows illustrates that development process for very simple GTK+ GUI application. This method can be used for much more than console applications,​ including Qt, GTK+, and even OpenGL to name a few.  The demonstration that follows illustrates that development process for very simple GTK+ GUI application.
 +
 +To utilize this example, please be sure to install the GTK development tooling to the ComfilePi panel PC using the command ''​sudo apt install libgtk-3-dev''​.
  
 {{:​comfilepi:​create_a_linux_project:​helloworld.zip|Download the source code}} for this demonstration. {{:​comfilepi:​create_a_linux_project:​helloworld.zip|Download the source code}} for this demonstration.
Line 11: Line 13:
   - Open Visual Studio to create a new project. \\ {{ :​comfilepi:​create_a_linux_project:​create_project.png |}} \\    - Open Visual Studio to create a new project. \\ {{ :​comfilepi:​create_a_linux_project:​create_project.png |}} \\ 
   - Use the //Empty Project// template, but others are also possible. \\ {{ :​comfilepi:​create_a_linux_project:​empty_project.png |}} \\   - Use the //Empty Project// template, but others are also possible. \\ {{ :​comfilepi:​create_a_linux_project:​empty_project.png |}} \\
-  - Change the platform to //ARM// or //ARM64// per the ComfilePi OS variant that you are using. \\ {{ :comfilepi:empty_project.png |}}+  - Change the platform to //ARM// or //ARM64// per the ComfilePi OS variant that you are using. \\ {{ :comfilepi:create_a_linux_project:​platform.png |}} 
 +  - Use the //​Connection Manager// to establish an SSH connection with the target ComfilePi panel PC.\\ {{ :​comfilepi:​create_a_linux_project:​connection_manager.png |}} \\ {{ :​comfilepi:​create_a_linux_project:​connection_manager_2.png |}}
   - Add a new //​main.cpp//​ source file with the following code.\\   - Add a new //​main.cpp//​ source file with the following code.\\
 <code c> <code c>
Line 56: Line 59:
 </​code>​ </​code>​
  
-There will be many Intellisense errors because we haven'​t yet modified ​the include paths for GTK.+There will be many Intellisense errors because we haven'​t yet updated ​the include paths for GTK.
  
 ===== Specify the Include Paths in the Project'​s Properties ===== ===== Specify the Include Paths in the Project'​s Properties =====
Line 64: Line 67:
   - Modify the //​C/​C++-->​General-->​Additional Include Directories//​ with the following: \\ <​code>​   - Modify the //​C/​C++-->​General-->​Additional Include Directories//​ with the following: \\ <​code>​
 /​usr/​include/​gtk-3.0;/​usr/​include/​at-spi2-atk/​2.0;/​usr/​include/​at-spi-2.0;/​usr/​include/​dbus-1.0;/​usr/​lib/​aarch64-linux-gnu/​dbus-1.0/​include;/​usr/​include/​gtk-3.0;/​usr/​include/​gio-unix-2.0;/​usr/​include/​cairo;/​usr/​include/​pango-1.0;/​usr/​include/​fribidi;/​usr/​include/​harfbuzz;​ /​usr/​include/​atk-1.0;/​usr/​include/​cairo;/​usr/​include/​pixman-1;/​usr/​include/​uuid;/​usr/​include/​freetype2;/​usr/​include/​libpng16;/​usr/​include/​gdk-pixbuf-2.0;/​usr/​include/​libmount;/​usr/​include/​blkid;/​usr/​include/​glib-2.0;/​usr/​lib/​aarch64-linux-gnu/​glib-2.0/​include /​usr/​include/​gtk-3.0;/​usr/​include/​at-spi2-atk/​2.0;/​usr/​include/​at-spi-2.0;/​usr/​include/​dbus-1.0;/​usr/​lib/​aarch64-linux-gnu/​dbus-1.0/​include;/​usr/​include/​gtk-3.0;/​usr/​include/​gio-unix-2.0;/​usr/​include/​cairo;/​usr/​include/​pango-1.0;/​usr/​include/​fribidi;/​usr/​include/​harfbuzz;​ /​usr/​include/​atk-1.0;/​usr/​include/​cairo;/​usr/​include/​pixman-1;/​usr/​include/​uuid;/​usr/​include/​freetype2;/​usr/​include/​libpng16;/​usr/​include/​gdk-pixbuf-2.0;/​usr/​include/​libmount;/​usr/​include/​blkid;/​usr/​include/​glib-2.0;/​usr/​lib/​aarch64-linux-gnu/​glib-2.0/​include
-</​code> ​\\ {{ :​comfilepi:​create_a_linux_project:​additional_includes.png |}} \\  These includes can be determined by running ​''​pkg-config --cflags gtk+-3.0'' ​on the ComfilePi. ​\\ \\ After adding the additional ​includes ​paths, there should no longer be any Intellisense errors.+</​code>​ {{ :​comfilepi:​create_a_linux_project:​additional_includes.png |}} \\  These includes can be determined by running ​<​html><​code>​pkg-config --cflags gtk+-3.0</​code></​html> ​on the ComfilePi. ​ After adding the additional ​include ​paths, there should no longer be any Intellisense errors.
  
 ===== Specify the Library Depenencies in the Project'​s Properties ===== ===== Specify the Library Depenencies in the Project'​s Properties =====
   - The prior step will solve the Intellisense errors, but there will still be linker errors when the project is compiled. ​ To resolve those errors, add the following library dependencies. \\ <​code>​   - The prior step will solve the Intellisense errors, but there will still be linker errors when the project is compiled. ​ To resolve those errors, add the following library dependencies. \\ <​code>​
 gtk-3;​pangocairo-1.0;​pango-1.0;​harfbuzz;​atk-1.0;​cairo-gobject;​cairo;​gdk_pixbuf-2.0;​gio-2.0;​gobject-2.0;​glib-2.0 gtk-3;​pangocairo-1.0;​pango-1.0;​harfbuzz;​atk-1.0;​cairo-gobject;​cairo;​gdk_pixbuf-2.0;​gio-2.0;​gobject-2.0;​glib-2.0
-</​code> ​\\+</​code>​
 {{ :​comfilepi:​create_a_linux_project:​library_dependencies.png }} \\ {{ :​comfilepi:​create_a_linux_project:​library_dependencies.png }} \\
 Those library dependencies can be obtained by running <​html><​code>​pkg-config --libs gtk+-3.0</​code></​html>​ on the ComfilePi. Those library dependencies can be obtained by running <​html><​code>​pkg-config --libs gtk+-3.0</​code></​html>​ on the ComfilePi.
  
 +If you encounter any Intellisense errors, try synchronizing Visual Studio'​s copy of the ComfilePi'​s header files in //​Tools-->​Options-->​Cross Platform-->​Connection Manager-->​Remote Headers Intellisense Manager// by selecting the appropriate connection and pressing the //​Download//​ or //Update// button.
  
 +{{ :​comfilepi:​create_a_linux_project:​intellisense.png }}
 ===== Deploy, Build, and Degug ===== ===== Deploy, Build, and Degug =====
  
   - Add ''​export DISPLAY=:​0.0''​ to the //​Configuration Properties-->​Debugging-->​Pre-Launch Command// setting so the ComfilePi knows which display to show the window on. \\ {{ :​comfilepi:​create_a_linux_project:​export_display.png |}}\\    - Add ''​export DISPLAY=:​0.0''​ to the //​Configuration Properties-->​Debugging-->​Pre-Launch Command// setting so the ComfilePi knows which display to show the window on. \\ {{ :​comfilepi:​create_a_linux_project:​export_display.png |}}\\ 
-  - Start the //Remote GDB Debugger//.  The source code will be uploaded to the ComfilePi to be built. \\ {{ :​comfilepi:​create_a_linux_project:​deploy_build_debug.png |}} \\ \\ The first time, a //Connect to Remote System// dialog window may appear. Enter the IP address of the ComfilePi in the //Host name// field and enter the ComfilePi'​s user credentials. \\ {{ :​comfilepi:​create_a_linux_project:​connect_dialog.png |}} \\ \\ The settings can be changed in the //​Configuration Properties-->​General-->​Remote Build Machine// setting. \\ {{ :​comfilepi:​create_a_linux_project:​remote_build_settings.png? ​|}} \\  +  - Start debugging.  The source code will be uploaded to the ComfilePi to be built. \\ {{ :​comfilepi:​create_a_linux_project:​start_debug.png |}} \\  
-  - If no build errors are encountered,​ the program will execute on the ComfilePi, and the Visual Studio Remote GDB Debugger will attach to it.  Go to //​Debug-->​Linux Console// to display the Linux Console Window and view any messages from ''​printf''​ statements. \\ {{ :​comfilepi:​create_a_linux_project:​debugging.png |}}+  - If no build errors are encountered,​ the program will execute on the ComfilePi, and the Visual Studio Remote GDB Debugger will attach to it.  Go to //​Debug-->​Linux Console// to display the Linux Console Window and view any messages from ''​printf''​ and/or ''​gprint''​ statements. \\ {{ :​comfilepi:​create_a_linux_project:​debugging.png |}}
  
 {{ :​comfilepi:​create_a_linux_project:​gtk_window.png |}} {{ :​comfilepi:​create_a_linux_project:​gtk_window.png |}}
 +
 +===== Additional Resources =====
 +  * [[https://​www.gtk.org/​docs/​|GTK Documentation]]
 +  * Install GTK examples with `sudo apt install gtk-3-examples`. ​ The examples will be installed to ///​usr/​share/​doc/​gtk-3-examples/​examples//​
 +  * Use the [[https://​glade.gnome.org/​|Glade]] on a Linux PC to create a GUI using a WYSIWYG designer. \\ {{ :​comfilepi:​create_a_linux_project:​glade-main-page.png }}
 +
comfilepi/create_a_linux_project/index.1674624830.txt.gz · Last modified: 2023/01/25 14:33 by COMFILE Technology