I am trying to write a C++ program in CLion and use one self-defined environment variable. The OS is Ubuntu 16.04
Say the environment variable is the $test.
int main (int argc, char **argv){
std::cout<<getenv("PATH");
std::cout<<getenv("test");
}
I have set the environment variable in the setting->build...->CMAKE->Environment environment variable set
I am able to print it when build through CMAKE.
message($ENV{test})
this is test
But whenbuild and run the compiled code above, only $PATH was print out. It seems the program cannot find the $test variable.
Anyone know how to tackle this problem?