{"id":3233,"date":"2017-09-29T13:43:37","date_gmt":"2017-09-29T20:43:37","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=3233"},"modified":"2020-04-10T17:06:22","modified_gmt":"2020-04-11T00:06:22","slug":"targeting-multiple-platforms-in-one-project","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/porting\/multiplatform\/","title":{"rendered":"Targeting Multiple Platforms in One Project"},"content":{"rendered":"<p>This tutorial shows how to create multi-platform Visual Studio projects with VisualGDB. We will start with a basic Win32 console project and show how to add platforms for Linux, Android and a barebone ARM device (STM32).<\/p>\n<p>Combining multiple platforms in one project is an advanced task that requires editing several configuration files, so we will give a detailed explanation of the involved settings and will show all the necessary edits. Before you begin, install VisualGDB 5.3 or later.<\/p>\n<ol>\n<li>Start with creating a regular Windows project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/01-winprj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3234\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/01-winprj.png\" alt=\"01-winprj\" width=\"941\" height=\"653\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/01-winprj.png 941w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/01-winprj-300x208.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/01-winprj-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/01-winprj-130x90.png 130w\" sizes=\"(max-width: 941px) 100vw, 941px\" \/><\/a><\/li>\n<li>Select &#8220;Console Application&#8221; and uncheck the &#8220;precompiled header&#8221; and &#8220;SDL checks&#8221; checkboxes: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/02-multiplatform.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3235\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/02-multiplatform.png\" alt=\"02-multiplatform\" width=\"667\" height=\"522\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/02-multiplatform.png 667w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/02-multiplatform-300x235.png 300w\" sizes=\"(max-width: 667px) 100vw, 667px\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to build the project and replace the code in the main source file with this:\n<pre class=\"\">include &lt;iostream&gt;\r\n\r\n#ifdef _WIN32\r\n#include &lt;winsock.h&gt;\r\n#pragma comment (lib, \"ws2_32\")\r\n#else\r\n#include &lt;unistd.h&gt;\r\n#endif\r\n\r\nint main()\r\n{\r\n#ifdef _WIN32\r\n\u00a0\u00a0 \u00a0WSADATA data;\r\n\u00a0\u00a0 \u00a0WSAStartup(MAKEWORD(2, 0), &amp;data);\r\n#endif\r\n\u00a0\u00a0\u00a0 char name[512];\r\n\u00a0\u00a0\u00a0 gethostname(name, sizeof(name));\r\n\u00a0\u00a0\u00a0 std::cout &lt;&lt; \"Hello, \" &lt;&lt; name &lt;&lt; std::endl;\r\n\u00a0\u00a0\u00a0 return 0;\r\n}<\/pre>\n<p><a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/04-linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3236\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/03-prj.png\" alt=\"03-prj\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/03-prj.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/03-prj-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/03-prj-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/03-prj-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/03-prj-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>You could normally use the <a href=\"https:\/\/visualgdb.com\/tutorials\/porting\/linux\/\">VisualGDB Configuration Wizard<\/a> to add a new Linux configuration to the existing project, however it would not allow combining VisualGDB MSBuild configurations with other configuration types (such as normal Win32 or Android), so we will show how to add a new platform manually instead. Begin with creating a new temporary Linux project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/04-linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3237\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/04-linux.png\" alt=\"04-linux\" width=\"786\" height=\"588\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/04-linux.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/04-linux-300x224.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<li>Select &#8220;MSBuild&#8221; on the first page:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/05-msbuild.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3238\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/05-msbuild.png\" alt=\"05-msbuild\" width=\"822\" height=\"662\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/05-msbuild.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/05-msbuild-300x242.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Then select the machine you would like to use for building:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/06-machine.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3239\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/06-machine.png\" alt=\"06-machine\" width=\"822\" height=\"662\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/06-machine.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/06-machine-300x242.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Finally select where to store the source files:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/07-source.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3240\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/07-source.png\" alt=\"07-source\" width=\"822\" height=\"662\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/07-source.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/07-source-300x242.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to create the project and open its directory in Explorer. The project directory will include 2 important types of files:\n<ul>\n<li>.vcxproj files containing the project itself and MSBuild-specific settings<\/li>\n<li>.vgdbsettings files containing VisualGDB-specific project properties<\/li>\n<\/ul>\n<p>The table below summarizes the location where common settings are stored:<\/p>\n<table>\n<tbody>\n<tr>\n<td>Setting<\/td>\n<td>.vgdbsettings file<\/td>\n<td>.vcxproj file<\/td>\n<\/tr>\n<tr>\n<td>Remote build machine name<\/td>\n<td>yes<\/td>\n<td>yes<\/td>\n<\/tr>\n<tr>\n<td>Toolchain ID<\/td>\n<td>yes<\/td>\n<td>yes<\/td>\n<\/tr>\n<tr>\n<td>Remote directories<\/td>\n<td>yes<\/td>\n<td>no<\/td>\n<\/tr>\n<tr>\n<td>Debug\/deployment settings<\/td>\n<td>yes<\/td>\n<td>no<\/td>\n<\/tr>\n<tr>\n<td>Source upload settings<\/td>\n<td>yes<\/td>\n<td>no<\/td>\n<\/tr>\n<tr>\n<td>Build flags (e.g. optimization)<\/td>\n<td>no<\/td>\n<td>yes<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/08-files.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3241\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/08-files.png\" alt=\"08-files\" width=\"916\" height=\"329\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/08-files.png 916w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/08-files-300x108.png 300w\" sizes=\"(max-width: 916px) 100vw, 916px\" \/><\/a><\/li>\n<li>We will move the common settings (e.g. the remote build machine) from the temporary project to the combined project by copying the .vgdbsettings file, however before we do that, we would need to add another platform to MSBuild platform list so that MSBuild can recognize it. Locate the platforms directory for your Visual Studio version and open the VisualGDB platform directory inside it:<br \/>\n<table>\n<tbody>\n<tr>\n<td>Visual Studio version<\/td>\n<td>Default platform directory<\/td>\n<\/tr>\n<tr>\n<td>2010<\/td>\n<td>C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\Platforms<\/td>\n<\/tr>\n<tr>\n<td>2012<\/td>\n<td>C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\V110\\Platforms<\/td>\n<\/tr>\n<tr>\n<td>2013<\/td>\n<td>C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\V120\\Platforms<\/td>\n<\/tr>\n<tr>\n<td>2015<\/td>\n<td>C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\V140\\Platforms<\/td>\n<\/tr>\n<tr>\n<td>2017<\/td>\n<td>C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\VC\\VCTargets\\Platforms<\/td>\n<\/tr>\n<tr>\n<td>2019<\/td>\n<td>C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\&lt;Edition&gt;\\MSBuild\\Microsoft\\VC\\v160\\Platforms<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/09-platform.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3242\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/09-platform.png\" alt=\"09-platform\" width=\"916\" height=\"329\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/09-platform.png 916w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/09-platform-300x108.png 300w\" sizes=\"(max-width: 916px) 100vw, 916px\" \/><\/a><\/li>\n<li>Copy the &#8216;VisualGDB&#8217; directory to a new &#8216;Linux&#8217; directory and rename the files containing &#8216;VisualGDB&#8217; in the name accordingly:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/10-linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3243\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/10-linux.png\" alt=\"10-linux\" width=\"916\" height=\"329\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/10-linux.png 916w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/10-linux-300x108.png 300w\" sizes=\"(max-width: 916px) 100vw, 916px\" \/><\/a><\/li>\n<li>Note that the files in the Platforms\\VisualGDB directory are simply references to similar named files in $(VISUALGDB_DIR)\\MSBuild:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/11-file.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3244\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/11-file.png\" alt=\"11-file\" width=\"1043\" height=\"238\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/11-file.png 1043w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/11-file-300x68.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/11-file-1024x234.png 1024w\" sizes=\"(max-width: 1043px) 100vw, 1043px\" \/><\/a><\/li>\n<li>Restart Visual Studio and open Configuration Manager:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/12-cfgmgr1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3284\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/12-cfgmgr1.png\" alt=\"12-cfgmgr\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/12-cfgmgr1.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/12-cfgmgr1-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/12-cfgmgr1-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/12-cfgmgr1-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/12-cfgmgr1-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>Select Platform-&gt;New: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/13-newplatform.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3247\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/13-newplatform.png\" alt=\"13-newplatform\" width=\"702\" height=\"443\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/13-newplatform.png 702w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/13-newplatform-300x189.png 300w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/a><\/li>\n<li>Then locate the new &#8216;Linux&#8217; platform, select &#8220;Copy from: &lt;Empty&gt;&#8221; and press OK:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/14-linuxplatform.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3248\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/14-linuxplatform.png\" alt=\"14-linuxplatform\" width=\"335\" height=\"223\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/14-linuxplatform.png 335w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/14-linuxplatform-300x200.png 300w\" sizes=\"(max-width: 335px) 100vw, 335px\" \/><\/a><\/li>\n<li>Visual Studio will create a new solution platform called &#8216;Linux&#8217;. As it is linked to the VisualGDB MSBuild files, it will be controlled by the VisualGDB MSBuild backend similar to the normal &#8216;VisualGDB&#8217; platform. Open VS project properties for the new platform and take a note of the &#8216;VisualGDB Settings File&#8217; setting:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/15-vgdbsettings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3249\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/15-vgdbsettings.png\" alt=\"15-vgdbsettings\" width=\"822\" height=\"558\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/15-vgdbsettings.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/15-vgdbsettings-300x204.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Copy the .vgdbsettings file from the temporary project and rename it so that it matches the name in the VS project properties:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/16-copied.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3250\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/16-copied.png\" alt=\"16-copied\" width=\"786\" height=\"376\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/16-copied.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/16-copied-300x144.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<li>Now you can right-click on the project in Solution Explorer and select &#8220;VisualGDB Project Properties&#8221; (ensure you have the new &#8216;Linux&#8217; platform selected). Then got to the MSBuild Setting page and click the &#8216;repair&#8217; link below:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/17-repair.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3251\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/17-repair.png\" alt=\"17-repair\" width=\"847\" height=\"635\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/17-repair.png 847w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/17-repair-300x225.png 300w\" sizes=\"(max-width: 847px) 100vw, 847px\" \/><\/a>Note that if you have not opened VisualGDB-based projects since starting Visual Studio yet, many VisualGDB menu items won&#8217;t appear. If this is the case, open the Help-&gt;About VisualGDB window to force the full initialization of VisualGDB, after which all menu commands will become available.<\/li>\n<li>VisualGDB will propagate the common settings like <strong>toolchain ID<\/strong> and <strong>build machine<\/strong> to the .vcxproj file so that MSBuild will be able to build the project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/18-properties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3252\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/18-properties.png\" alt=\"18-properties\" width=\"822\" height=\"558\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/18-properties.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/18-properties-300x204.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Build the project via Build-&gt;Build Solution:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/19-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3253\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/19-build.png\" alt=\"19-build\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/19-build.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/19-build-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/19-build-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/19-build-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/19-build-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>Start debugging it and see how the gethostname() returned the name of your Linux machine:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/20-run.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3254\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/20-run.png\" alt=\"20-run\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/20-run.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/20-run-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/20-run-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/20-run-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/20-run-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>The VS project properties for the Linux platform are controlled by the VisualGDB MSBuild backend, so they will reflect GCC-specific settings:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/21-gccsettings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3255\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/21-gccsettings.png\" alt=\"21-gccsettings\" width=\"822\" height=\"558\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/21-gccsettings.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/21-gccsettings-300x204.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Now we will show how to add another platform for a command-line Android tool. Create a new temporary Android project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/22-android.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3256\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/22-android.png\" alt=\"22-android\" width=\"819\" height=\"568\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/22-android.png 819w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/22-android-300x208.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/22-android-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/22-android-130x90.png 130w\" sizes=\"(max-width: 819px) 100vw, 819px\" \/><\/a><\/li>\n<li>Select &#8220;Create a command-line Android executable&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/23-cmdline.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3257\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/23-cmdline.png\" alt=\"23-cmdline\" width=\"822\" height=\"642\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/23-cmdline.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/23-cmdline-300x234.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Select your Android platform and click &#8220;Finish&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/24-platform.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3258\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/24-platform.png\" alt=\"24-platform\" width=\"822\" height=\"642\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/24-platform.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/24-platform-300x234.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>The VisualGDB Android projects are built with the ndk-build scripts, not MSBuild, so the file structure is slightly different. The &#8216;jni&#8217; folder contains the files with build settings (e.g. Android.mk), the <strong>gcc_Debug.h<\/strong> and <strong>gcc_Release.h<\/strong> files contain snapshots of GCC preprocessor macros used for IntelliSense and the .vgdbsettings file contains all project settings:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/25-androidfiles.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3259\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/25-androidfiles.png\" alt=\"25-androidfiles\" width=\"786\" height=\"409\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/25-androidfiles.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/25-androidfiles-300x156.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<li>Copy the files mentioned above to the multi-platform project and rename the .vgdbsettings file accordingly:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/26-androidsettings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3260\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/26-androidsettings.png\" alt=\"26-androidsettings\" width=\"786\" height=\"409\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/26-androidsettings.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/26-androidsettings-300x156.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<li>Then copy the &#8216;Win32&#8217; MSBuild platform (<strong>not &#8216;VisualGDB&#8217; platform<\/strong>) under the &#8216;Android_Cmdline&#8217; name:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/android.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3285\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/android.png\" alt=\"android\" width=\"916\" height=\"329\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/android.png 916w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/android-300x108.png 300w\" sizes=\"(max-width: 916px) 100vw, 916px\" \/><\/a><\/li>\n<li>Restart Visual Studio and create a new project\/solution platform:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/28-nmake.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3261\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/27-platform.png\" alt=\"27-platform\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/27-platform.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/27-platform-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/27-platform-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/27-platform-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/27-platform-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>As Android build process is not controlled by the VisualGDB MSBuild backend, the settings for it will look different. First of all, change the Configuration Type to Makefile and click &#8220;Apply&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/28-nmake.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3262\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/28-nmake.png\" alt=\"28-nmake\" width=\"822\" height=\"558\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/28-nmake.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/28-nmake-300x204.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Then go to the NMake page and set Output to match the <strong>.vgdbsettings<\/strong> file name. This will let VisualGDB recognize this configuration and let you debug it:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/29-output.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3263\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/29-output.png\" alt=\"29-output\" width=\"926\" height=\"558\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/29-output.png 926w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/29-output-300x181.png 300w\" sizes=\"(max-width: 926px) 100vw, 926px\" \/><\/a><\/li>\n<li>Open VisualGDB Project Properties and click the &#8220;Repair&#8221; link:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/30-fixcfg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3264\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/30-fixcfg.png\" alt=\"30-fixcfg\" width=\"847\" height=\"635\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/30-fixcfg.png 847w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/30-fixcfg-300x225.png 300w\" sizes=\"(max-width: 847px) 100vw, 847px\" \/><\/a>VisualGDB will automatically fill the build\/clean command lines in the Visual Studio project properties so that Visual Studio will run VisualGDB to do the actual build.<\/li>\n<li>Go to the &#8220;Makefile Settings&#8221; page and switch STL to gnustl_static:\u00a0<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/31-stl.png\"> <img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3265\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/31-stl.png\" alt=\"31-stl\" width=\"847\" height=\"635\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/31-stl.png 847w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/31-stl-300x225.png 300w\" sizes=\"(max-width: 847px) 100vw, 847px\" \/><\/a><\/li>\n<li>Finally press &#8220;OK&#8221; and build the project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/32-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3266\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/32-build.png\" alt=\"32-build\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/32-build.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/32-build-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/32-build-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/32-build-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/32-build-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a>See how the same project is now build using the Android build toolset.<\/li>\n<li>Connect your Android device and press F5 to start debugging. See how the executable gets launched on the device:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/33-debug-android.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3267\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/33-debug-android.png\" alt=\"33-debug-android\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/33-debug-android.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/33-debug-android-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/33-debug-android-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/33-debug-android-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/33-debug-android-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>Now will will add another platform for a barebone ARM device (STM32). Create a temporary Embedded project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/34-embedded.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3268\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/34-embedded.png\" alt=\"34-embedded\" width=\"819\" height=\"568\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/34-embedded.png 819w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/34-embedded-300x208.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/34-embedded-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/34-embedded-130x90.png 130w\" sizes=\"(max-width: 819px) 100vw, 819px\" \/><\/a><\/li>\n<li>Select the toolchain and the device:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/35-arm.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3269\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/35-arm.png\" alt=\"35-arm\" width=\"822\" height=\"642\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/35-arm.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/35-arm-300x234.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Proceed with the default sample:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/36-blink.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3270\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/36-blink.png\" alt=\"36-blink\" width=\"822\" height=\"642\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/36-blink.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/36-blink-300x234.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Select your debug method:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/37-stlink.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3271\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/37-stlink.png\" alt=\"37-stlink\" width=\"822\" height=\"642\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/37-stlink.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/37-stlink-300x234.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to generate the project. The structure of the embedded project is similar to the structure of an MSBuild-based Linux project with 2 important differences:\n<ul>\n<li>The embedded project stores global device-specific flags (like the SDK include directories) in a separate file called stm32.props and a set of common embedded settings in stm32.xml<\/li>\n<li>The project must include some MCU-specific files (e.g. <strong>system_stm32f4xx.c<\/strong>).<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/38-embfiles.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3272\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/38-embfiles.png\" alt=\"38-embfiles\" width=\"786\" height=\"443\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/38-embfiles.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/38-embfiles-300x169.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<li>Copy the &#8216;VisualGDB&#8217; MSBuild platform to &#8216;Embedded&#8217;, restart Visual Studio and create a new project\/solution configuration:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/39-embedded.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3273\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/39-embedded.png\" alt=\"39-embedded\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/39-embedded.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/39-embedded-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/39-embedded-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/39-embedded-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/39-embedded-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>Copy and rename the .vgdbsettings file and also copy the mcu-specific .props\/.xml files together with the system file and the HAL configuration file. Then open VisualGDB Project Properties on the MSBuild Settings page and click the &#8220;Repair&#8221; link:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/40-fixtoolchain.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3274\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/40-fixtoolchain.png\" alt=\"40-fixtoolchain\" width=\"847\" height=\"635\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/40-fixtoolchain.png 847w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/40-fixtoolchain-300x225.png 300w\" sizes=\"(max-width: 847px) 100vw, 847px\" \/><\/a><\/li>\n<li>Then go to the Embedded Project page of VisualGDB Project Properties and click &#8220;Regenerate MCU files&#8221; (or change the MCU back and forth):<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/42-regen.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3276\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/42-regen.png\" alt=\"42-regen\" width=\"786\" height=\"594\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/42-regen.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/42-regen-300x227.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<li>VisualGDB will update the configuration settings and add the STM32-specific files to the project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/41-emb.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3275\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/41-emb.png\" alt=\"41-emb\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/41-emb.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/41-emb-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/41-emb-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/41-emb-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/41-emb-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>Go to the Embedded Frameworks page and enable Fast Semihosting and Embedded Profiler:\u00a0 <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/43-semihost.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3277\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/43-semihost.png\" alt=\"43-semihost\" width=\"786\" height=\"594\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/43-semihost.png 786w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/43-semihost-300x227.png 300w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><\/li>\n<li>Finally add an implementation of the gethostname() function so that it can compile without an underlying OS:\n<pre class=\"\">#if defined(__arm__) &amp;&amp; !defined(__linux__)\r\n#include &lt;string.h&gt;\r\n\r\nstatic void gethostname(char *pBuffer, int size)\r\n{\r\n\u00a0\u00a0\u00a0 strncpy(pBuffer, \"(embedded)\", size);\r\n}\r\n#endif<\/pre>\n<\/li>\n<li>Connect your embedded device, build the project and start debugging it. Ensure it runs correctly and displays the output:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/44-embedded-dbg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3278\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/44-embedded-dbg.png\" alt=\"44-embedded-dbg\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/44-embedded-dbg.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/44-embedded-dbg-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/44-embedded-dbg-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/44-embedded-dbg-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/44-embedded-dbg-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>If you try building the Linux or Windows configuration now, they will fail because the embedded project has added multiple STM32-specific files. You can fix this by excluding them from build for those configurations. First select all of the STM32-specific files, right-click and select &#8220;Properties&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/45-files.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3279\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/45-files.png\" alt=\"45-files\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/45-files.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/45-files-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/45-files-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/45-files-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/45-files-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>Select &#8220;Multiple Platforms&#8221; and check every platform except the Embedded one:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/46-multi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3280\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/46-multi.png\" alt=\"46-multi\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/46-multi.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/46-multi-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/46-multi-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/46-multi-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/46-multi-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>Set &#8220;Excluded from Build -&gt; yes&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/47-excl.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3281\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/47-excl.png\" alt=\"47-excl\" width=\"926\" height=\"558\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/47-excl.png 926w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/47-excl-300x181.png 300w\" sizes=\"(max-width: 926px) 100vw, 926px\" \/><\/a><\/li>\n<li>Now you should be able to build the Windows and Linux platforms as well as Embedded:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/48-allplatforms.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3282\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/48-allplatforms.png\" alt=\"48-allplatforms\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/48-allplatforms.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/48-allplatforms-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/48-allplatforms-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/48-allplatforms-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/48-allplatforms-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a><\/li>\n<li>Android build system won&#8217;t be able to handle the BSP-specific paths of STM32 source files, so simply delete the &#8220;AutoUpdateSourcesInNextLine&#8221; line and list the Android-compatible files in the LOCAL_SRC_FILES line:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/49-android.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3283\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/49-android.png\" alt=\"49-android\" width=\"1041\" height=\"719\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/49-android.png 1041w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/49-android-300x207.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/49-android-1024x707.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/49-android-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/09\/49-android-130x90.png 130w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/a>Congratulations! Now you can build the same project on 4 different platforms.<\/li>\n<li>If you don&#8217;t want to create extra MSBuild platforms (like &#8216;Embedded&#8217; or &#8216;Linux&#8217;), you can add new project configurations instead, e.g. Debug (Linux) and Release (Linux) and repeat the steps above to link them with VisualGDB. The only constraint is that:\n<ul>\n<li>Configurations using VisualGDB MSBuild backend should be created within the &#8216;VisualGDB&#8217; platform (or platforms copied from it).<\/li>\n<li>Configurations using other build systems (e.g. Android, Make, CMake or QMake) should be created within the &#8216;Win32&#8217; or &#8216;x64&#8217; platform and switched to &#8216;NMake&#8217;.<\/li>\n<\/ul>\n<p>As Visual Studio treats platforms\/configurations as a 2-dimensional matrix, combining MSBuild and non-MSBuild configurations in one project would create some unusable configurations, e.g.:<\/p>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td>Debug (Win32)<\/td>\n<td>Debug (Linux)<\/td>\n<td>Debug (Embedded)<\/td>\n<td>Debug(Android)<\/td>\n<\/tr>\n<tr>\n<td>Win32 platform<\/td>\n<td><strong>Usable<\/strong><\/td>\n<td>Unusable<\/td>\n<td>Unusable<\/td>\n<td><strong>Usable<\/strong><\/td>\n<\/tr>\n<tr>\n<td>VisualGDB platform<\/td>\n<td>Unusable<\/td>\n<td><strong>Usable<\/strong><\/td>\n<td><strong>Usable<\/strong><\/td>\n<td>Unusable<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Creating additional MSBuild platforms as shown in this tutorial makes the platform\/configuration matrix more compact:<\/p>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td>Debug<\/td>\n<\/tr>\n<tr>\n<td>Win32 platform<\/td>\n<td>Usable<\/td>\n<\/tr>\n<tr>\n<td>Linux platform (copied from VisualGDB)<\/td>\n<td>Usable<\/td>\n<\/tr>\n<tr>\n<td>Embedded platform (copied from VisualGDB)<\/td>\n<td>Usable<\/td>\n<\/tr>\n<tr>\n<td>Android platform (copied from Win32)<\/td>\n<td>Usable<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/li>\n<li>Note that starting from version 5.4, VisualGDB will only load itself into Visual Studio if you explicitly use one of its menu commands, or if the opened project contains one of the following strings:\n<ul>\n<li>&lt;Platform&gt;VisualGDB&lt;\/Platform&gt;<\/li>\n<li>$(VISUALGDB_DIR)<\/li>\n<li>.vgdbsettings<\/li>\n<\/ul>\n<p>This is done to eliminate any startup delays when opening non-VisualGDB projects. If the changes you&#8217;ve done to the project file resulted in removal of all the strings shown above, you would need to manually enable VisualGDB (e.g. by using the Help-&gt;About VisualGDB) after loading the project. Alternatively, edit the .vcxproj file so that it will contain one of the strings shown above (e.g. change the default name of the .vgdbsettings file via VS Project Properties).<\/li>\n<\/ol>\n<p>You can find the source code shown in this tutorial in our <a href=\"https:\/\/github.com\/sysprogs\/tutorials\/tree\/master\/visualgdb\/porting\/multiplatform\">Github repository<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to create multi-platform Visual Studio projects with VisualGDB. We will start with a basic Win32 console<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[84],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/3233"}],"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=3233"}],"version-history":[{"count":6,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/3233\/revisions"}],"predecessor-version":[{"id":5910,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/3233\/revisions\/5910"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=3233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=3233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=3233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}