Project-specific environment variables appear to only get defined in Debug [message #1398041] |
Thu, 10 July 2014 14:16 |
|
I don't know if I misconfigured something, but near as I can tell, project-specific environment variables only get defined when executed in Debug.
My Environment:
- Version: Luna Release (4.4.0)
- Build id: 20140612-0600
- Windows 7 x64 with MinGW installed using mingw-get-setup.exe
- java -version --> java version "1.7.0_51"
- gcc version 4.8.1 (GCC)
I created a new "Hello World C++ project" using the MinGW GCC Toolchain and replaced the template code with the following (made it about as small as I could for this post):#include <iostream>
#include <cstdlib>
int main() {
std::string varname("OMQLIB");
char *envvalue = std::getenv( varname.c_str() );
if( envvalue != NULL )
std::cout << varname << " defined as: " << envvalue << std::endl;
else
std::cout << varname << " not defined" << std::endl;
return 0;
} I right-clicked on the project, chose Properties, expanded C/C++ Build, selected Environment, and then did the following (leaving the radio button as "Append variables to native environment"):
- Selected the Debug Configuration from the pull-down menu
- Clicked Add... and set the Name to OMQLIB and Value to DEBUG
- Selected the Release Configuration
- Clicked Add... and set the Name to OMQLIB and Value to RELEASE
I did all this after trying simply setting the same variable for all configurations, etc.
When I run the Debug configuration of my application, as expected it generates following output:
OMQLIB defined as: DEBUG
So far so good, but unfortunately when I run the Release configuration of my application generates following output:
OMQLIB not defined
I tried setting the variable in "All Configurations" with the same behavior.
My final test I "manually" defined the variable for my "Release configuration" in the Run Configurations screen itself:
And finally I got this output:
OMQLIB defined as: Manually Set
Any ideas on why the project-definition of an environment variable doesn't seem to work except for Debug, but (thankfully) manually setting it for the specific run configuration does?
SenseiC bows out.
[Updated on: Thu, 10 July 2014 14:24] Report message to a moderator
|
|
|
|
|
Re: Project-specific environment variables appear to only get defined in Debug [message #1399401 is a reply to message #1398616] |
Sat, 12 July 2014 14:52 |
|
Sigh. Kind of like an episode of "Brain Games"... I saw the word Build, but never bothered to apply it to the phrase build environment. "I see!", said the blind man to his deaf horse.
Of course now I look at it and it makes perfect sense.
Too bad I can't say the same about the decision to have the compiler Include Paths specified in the top pane and the Include Files in the lower pane... and the exact opposite for Linker libraries.
Thank you for your assistance.
SenseiC bows out.
[Updated on: Sat, 12 July 2014 14:53] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03484 seconds