{"id":5718,"date":"2020-03-22T20:32:38","date_gmt":"2020-03-23T03:32:38","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=5718"},"modified":"2020-03-22T20:32:38","modified_gmt":"2020-03-23T03:32:38","slug":"visualgdb-project-variables","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/documentation\/variables\/","title":{"rendered":"VisualGDB Project Variables"},"content":{"rendered":"<p>To avoid hardcoding absolute file paths in the VisualGDB project properties files, VisualGDB defines the following project variables:<\/p>\n<table class=\"neat_table\" style=\"height: 600px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(VISUALGDB_DIR)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">The directory containing VisualGDB.exe<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(ConfigurationName)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">The name of the current project configuration<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(ProjectDir)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">The directory containing the Visual Studio project<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(ProjectDirUnixStyle)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">Project directory converted to &#8216;c\/dir\/file.cpp&#8217; format.<\/td>\n<\/tr>\n<tr style=\"height: 144px;\">\n<td style=\"height: 144px; width: 164.1px;\">$(LocalSourceDir)<\/td>\n<td style=\"height: 144px; width: 552.967px;\">Directory containing source files (path on the Windows computer):<\/p>\n<ul>\n<li>For Remote projects &#8211; source directory specified in file transfer settings<\/li>\n<li>For Custom projects &#8211; user-defined variable<\/li>\n<li>For other project types &#8211; equivalent to <strong> $(ProjectDir)<\/strong><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr style=\"height: 144px;\">\n<td style=\"height: 144px; width: 164.1px;\">$(RemoteSourceDir)<\/td>\n<td style=\"height: 144px; width: 552.967px;\">Directory containing source files (path on remote computer if applicable)<\/p>\n<ul>\n<li>For Remote projects &#8211; destination directory in file transfer settings<\/li>\n<li>For Custom projects &#8211; user-defined variable<\/li>\n<li>For other project types &#8211; undefined<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr style=\"height: 48px;\">\n<td style=\"height: 48px; width: 164.1px;\">$(SourceDir)<\/td>\n<td style=\"height: 48px; width: 552.967px;\">For Remote projects &#8211; equivalent to <strong> $(RemoteSourceDir)<\/strong><br \/>\nFor other projects &#8211; equivalent to <strong> $(LocalSourceDir)<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(BuildDir)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">User-defined directory where build commands are executed.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(TargetPath)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">Full path to the main binary file of the project (e.g. the EXE file)<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(TargetDir)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">The directory containing the main binary file of the project<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(TargetFileName)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">The name of the main project binary<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(TargetExtension)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">The extension of the main project binary<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(DeployPath)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">Full path of main binary on the deployment machine (cross-compiler projects)<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 164.1px;\">$(DeployHost)<\/td>\n<td style=\"height: 24px; width: 552.967px;\">Host name of the deployment machine (cross-compiler projects)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Additionally to that, you can use the following syntax to modify the value of each variable:<\/p>\n<table class=\"neat_table\">\n<tbody>\n<tr>\n<td>$(Variable.unixstyle)<\/td>\n<td>Convert <strong>c:\\foo\\bar<\/strong> to <strong>c\/foo\/bar<\/strong><\/td>\n<\/tr>\n<tr>\n<td>$(Variable.forwardslashes)<\/td>\n<td>Convert <strong>c:\\foo\\bar<\/strong> to <strong>c:\/foo\/bar<\/strong><\/td>\n<\/tr>\n<tr>\n<td>$(Variable.nospaces)<\/td>\n<td>Replace spaces with underscores<\/td>\n<\/tr>\n<tr>\n<td>$(Variable.defuse)<\/td>\n<td>Replace all non-identifier characters with underscores<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Additionally to the VisualGDB variables, you can use the Windows environment variables (e.g. <strong>$(LOCALAPPDATA)\\xyz<\/strong>).<\/p>\n<p>You can view the list of variables for a specific project by clicking the link at the bottom of the VisualGDB Project Properties window:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/vars.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5720\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/vars.png\" alt=\"\" width=\"1064\" height=\"634\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To avoid hardcoding absolute file paths in the VisualGDB project properties files, VisualGDB defines the following project variables: $(VISUALGDB_DIR) The<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[199],"tags":[],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/5718"}],"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=5718"}],"version-history":[{"count":2,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/5718\/revisions"}],"predecessor-version":[{"id":5721,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/5718\/revisions\/5721"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=5718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=5718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=5718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}