How can I use an environment variable, say %WINDIR% in VS? I tried in Properties > Preprocessor > Definitions > I added: ENV_VAR="($Windir)"
in my .cpp:
std::string s = ENV_VAR
but when executed it prints:
C:windows
How do I fix this?
Found the solution:
How to get a Visual Studio Macro Value into a pre processor directive?
in my example I should add:
ENV_VAR=R"?($(WINDIR))?"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With