Search code examples
visual-studio-2010buildconfig

Output file C++ build VS 2010


For a C++ project in Visual Studio 2010, that I have took back recently, I don't remember why I have two locations to define the output of the build:

  • first in project's Properties > Configuration Properties > General > Output Directory + Target Name + Target type.
  • second, in one shot, in project's Properties > Configuration Properties > Linker (or Librarian) > Output File.

I noted that the two can be different, thus what defines each? Also, from time to time, when I get into some "tinkering" I get the build error that the target doesn't match the link properties.

If anyone can clarify me that, I appreciate! Thanks


Solution

  • Yes, they should be identical.

    But there is a better option: use macros to ensure that Linker → General → Output File has the value it is supposed to. The Project Wizard does this for you by default, setting "Output File" to:

    $(OutDir)$(TargetName)$(TargetExt)
    

    That way, they never drift. If you update the properties on the main screen, the linker settings get automatically updated.