views:

323

answers:

2

In the linker the binary destination is specified as:

$(OutDir)\$(ProjectName).exe
(example)
(main.h)
(#define method1  1)
(#define method2  5)

supposed that method1, method2 is defined in main.h

is it possible that output filename in the linker will be (method1)_(method2).exe as 1_5.exe

A: 

You cannot name the linker Output File after anything in your source code. It's a static name listed in your project file.

You can, however, use variables like $(OutDir) and $(ProjectName), but these all come from other settings in your project file and/or the environment (like the .NET framework version if you're writing managed code). To see a list of the ones you can use, drop down the edit control next to "Output File" on the Linker page of your Project's properties and choose "Edit...". In the resulting dialog, you should be able to click the "Macros" button to expand a list of macros you can use in that project setting.

Nick Meyer
A: 

Output filename can not be defined from source code, but only from build environment.

If you use Visual Studio IDE, you can create multiple configurations, each with different #define constants (preprocessor defitions under confuration properties->(language) and a different output directory. If you require the exe filename format you've specified you can perform a copy as a post-build step.

Another way would be to build using makefiles; this will give total control over dependencies and output files be it at a very high initial effort to master and create makefiles.

Note: I've checked this for Visual Studio 2008 express edition / C++

Adriaan