Search code examples
c++visual-studiowebots

How to Change the command line macros in Visual Studio 2017


I'm trying to create a Webots controller in VS2017 (through the webots software). When it loads up Visual Studio, everything is linked correctly and compiles correctly until I close VS and reopen it. Afterwards the macro of $(WEBOTS_HOME) changes to an incorrect path, which messes up the links to the files and libraries.

I tried to hard code the path in through properties editor, but it just says that all the files don't exist.

Links to error images:

Correct Macro Path

Incorrect Macro + Correct Hard Coded Path

Error From Hard Coded Path

Is there any way to change what this macro evaluates as, or a way to keep it from changing in the first place? After spending a couple hours on the internet looking for answers, I've determined that I can't add a user macro, which was my idea to replace the broken macro, because I can't access "Project Manager" Tab, only a console version.


Solution

  • The WEBOTS_HOME environment variable is indeed supposed to be defined (for a typical Webots installation: WEBOTS_HOME = C:\Program Files\Webots). It can be defined in your user environment variables. Doing this, it will be accessible from VS.