I'm using gflags to parse command line parameters of a c++ application (v140, x64). For some reason, I get different results on Release and Debug mode. In debug mode, the argument is not identified.
code
#include <gflags/gflags.h>
DEFINE_string(str_arg, "default param value", "string value");
int main(int argc, char *argv[])
{
std::cout << "str value before glog init: " + FLAGS_str_arg << std::endl;
//third parameter is set to false. setting it to true doesn't solve the problem
google::ParseCommandLineFlags(&argc, &argv, false);
std::cout << "str value after glog init: " + FLAGS_str_arg << std::endl;
}
execution command
app.exe -str_arg new_val
output in Release mode
str value before glog init: default param value
str value after glog init: new_val
output in Debug mode
str value before glog init: default param value
str value after glog init: default param value