{"id":1740,"date":"2016-06-23T11:55:49","date_gmt":"2016-06-23T18:55:49","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=1740"},"modified":"2016-06-23T11:55:49","modified_gmt":"2016-06-23T18:55:49","slug":"creating-project-templates-for-linux-projects","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/linux\/templates\/","title":{"rendered":"Creating Project Templates for Linux Projects"},"content":{"rendered":"<p>This tutorial shows how to create project templates containing modified source files, build and debug settings so that you can quickly reuse them when creating projects on any machine with VisualGDB. We will create a basic Qt project, edit the GUI with the Qt Designer, change the debugging settings and convert it into a template.<\/p>\n<p>Before you begin, install VisualGDB 5.1 or later. Note that project templates are only available in the Custom edition and higher.<\/p>\n<ol>\n<li>Start Visual Studio and open VisualGDB Linux Project Wizard:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l01-prjname.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1741\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l01-prjname.png\" alt=\"l01-prjname\" width=\"786\" height=\"534\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l01-prjname.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l01-prjname-300x204.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<li>On the first page select &#8220;Create a new project -&gt; Use Qt&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l02-qt.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1742\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l02-qt.png\" alt=\"l02-qt\" width=\"682\" height=\"641\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l02-qt.png 682w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l02-qt-300x282.png 300w\" sizes=\"(max-width: 682px) 100vw, 682px\" \/><br \/>\n<\/a><\/li>\n<li>On the next page select either a cross-toolchain and a deployment machine or the machine where the project will be built and started:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l03-toolchain.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1743\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l03-toolchain.png\" alt=\"l03-toolchain\" width=\"682\" height=\"641\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l03-toolchain.png 682w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l03-toolchain-300x282.png 300w\" sizes=\"(max-width: 682px) 100vw, 682px\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to create your project. VisualGDB will generate a very basic &#8220;Hello, World&#8221; project based on the Qt framework. Open the MainWindow.ui file in the Qt Designer and add a text box to the window:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l04-designer.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1744\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l04-designer.png\" alt=\"l04-designer\" width=\"956\" height=\"676\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l04-designer.png 956w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l04-designer-300x212.png 300w\" sizes=\"(max-width: 956px) 100vw, 956px\" \/><\/a><\/li>\n<li>Then modify the main source file to show the text from the edit box when the button is clicked (if IntelliSense for the GUI does not work, build your project so that the GUI header files are generated, open VisualGDB Project Properties, change anything in the Include Directories field and press OK):<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l05-code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1745\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l05-code.png\" alt=\"l05-code\" width=\"956\" height=\"676\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l05-code.png 956w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l05-code-300x212.png 300w\" sizes=\"(max-width: 956px) 100vw, 956px\" \/><\/a><\/li>\n<li>Open VisualGDB Project Properties, go to the Debug Settings page and configure the project to show the GUI directly on the target machine instead of forwarding it to the Windows side:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l06-remote.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1746\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l06-remote.png\" alt=\"l06-remote\" width=\"786\" height=\"594\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l06-remote.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l06-remote-300x227.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<li>Press F5 to start debugging. Note how the new GUI is displayed on the Linux machine:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l07-hello.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1747\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l07-hello.png\" alt=\"l07-hello\" width=\"428\" height=\"328\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l07-hello.png 428w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l07-hello-300x230.png 300w\" sizes=\"(max-width: 428px) 100vw, 428px\" \/><\/a><\/li>\n<li>Now we will export the project to a template. Select File-&gt;Export VisulaGDB Project Template:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l08-template.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1748\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l08-template.png\" alt=\"l08-template\" width=\"893\" height=\"598\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l08-template.png 893w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l08-template-300x201.png 300w\" sizes=\"(max-width: 893px) 100vw, 893px\" \/><\/a><\/li>\n<li>Choose the file for the template. By default VisualGDB will suggest using the %LOCALAPPDATA%\\VisualGDB\\CustomProjectTemplates folder, however you can save anywhere you want:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l09-name.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1749\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l09-name.png\" alt=\"l09-name\" width=\"653\" height=\"144\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l09-name.png 653w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l09-name-300x66.png 300w\" sizes=\"(max-width: 653px) 100vw, 653px\" \/><\/a><\/li>\n<li>On any machine with VisualGDB that has access to the template file open the VisualGDB Linux Project Wizard:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l10-prj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1750\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l10-prj.png\" alt=\"l10-prj\" width=\"786\" height=\"471\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l10-prj.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l10-prj-300x180.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<li>Select &#8220;Create a project from a custom template&#8221;. Note how VisualGDB immediately allows you to change the build or deployment machine if your account on it is different from the one that was used when creating the template:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l11-seltemplate.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1751\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l11-seltemplate.png\" alt=\"l11-seltemplate\" width=\"749\" height=\"641\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l11-seltemplate.png 749w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l11-seltemplate-300x257.png 300w\" sizes=\"(max-width: 749px) 100vw, 749px\" \/><\/a><\/li>\n<li>You can press &#8220;Finish&#8221; to generate the project immediately, or press &#8220;Next&#8221; to review the project settings loaded from the template file:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l12-toolchain.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1752\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l12-toolchain.png\" alt=\"l12-toolchain\" width=\"749\" height=\"641\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l12-toolchain.png 749w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l12-toolchain-300x257.png 300w\" sizes=\"(max-width: 749px) 100vw, 749px\" \/><\/a><\/li>\n<li>Once you press &#8220;Finish&#8221;, the project will be generated. Note how it contains all of your changes to the source files:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l13-newcontents.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1753\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l13-newcontents.png\" alt=\"l13-newcontents\" width=\"893\" height=\"598\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l13-newcontents.png 893w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l13-newcontents-300x201.png 300w\" sizes=\"(max-width: 893px) 100vw, 893px\" \/><\/a>The templates will also remember additional include directories, preprocessor macros, CFLAGS\/CXXFLAGS and will contain any files added to the project that reside in the project directory or one of its subdirectories.<\/li>\n<li>Open the Debug Settings page of VisualGDB Project Properties to verify that the &#8220;Remote X11 Windows&#8221; setting was successfully set based on the template.<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l14-display.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1754\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l14-display.png\" alt=\"l14-display\" width=\"786\" height=\"531\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l14-display.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/03\/l14-display-300x203.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<\/ol>\n<p>The VisualGDB project template files are simply zip archives containing the project contents and the settings stored in the <strong>template.xml<\/strong> file. You can always edit them to tweak various template settings or add new files. As all of the settings are saved in one XML file, you can also use templates across different Visual Studio versions &#8211; e.g. a template created in Visual Studio 2015 will be usable in Visual Studio 2008 as long as both have VisualGDB installed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to create project templates containing modified source files, build and debug settings so that you can<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[38,33,123],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/1740"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=1740"}],"version-history":[{"count":2,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/1740\/revisions"}],"predecessor-version":[{"id":1971,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/1740\/revisions\/1971"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=1740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=1740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=1740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}