在Visual Studio中指定输出文件的良好做法

Visual Studio中有两处可以指定输出文件,为什么要这样呢?明明生成的输出文件只有唯一确定的一个!万一两处指定的不一致,就不会产生二义性吗?还好,linker中的那个设置会优先覆盖另一个。这里给出了一种十全十美的做法。


复制的3ds max sdk中的原文:


3ds Max SDK Programmer's Guide > Writing Plug-ins > Creating a Plug-in Project > Manually Creating a New Plug-in Project >  Specifying the Output File


You now need to specify the output file name. The output file path consists of three parts: the directory path, the filename and the extension. Starting with Visual Studio 2010, the file path specified in the Linker > General > Output Directory property needs to match the paths specified under Configuration > General. That means the directory portion of the output path must match the Configuration > General > Output Directory property. Also the filename portion of the output path must match the Configuration > General > Target Name property. And the file extension part of the output path must match the Configuration > General >Target Extension property. If the paths do not match, the compiler will emit a long verbose warning. Therefore the easiest and best way to specify the output path is to specify the three separate elements of the output path under Configuration > General. For example:

  1. Open the Project Property Pages dialog (e.g. from the menu under Project > Properties ...)
  2. Choose All Configurations from the Configuration: drop-down list at the top of the dialog.
  3. From the tree-control in the left pane choose the Configuration Properties > General folder.
  4. For the Output Directory property, specify the path to where you want the file to be built.
  5. For the Intermediate Directory property, It is usually best to specify obj\$(Platform)\$(Configuration). That way the intermediate files for different build configurations do not overwrite each other. This will also allow you to quickly and easily delete any intermdiate files after the build is cleaned up.
  6. For the Target Name property specify the name of the file.
  7. For the Target Extension property specify the file extension of the file.
  8. From the tree-control in the left pane chose the Linker > General folder.
  9. For the Output File property specify $(OutDir)$(TargetName)$(TargetExt). This will take the values you entered in earlier and combine them to form the output path.

你可能感兴趣的:(C++,Visual,工程配置)