Visual Studio 2010 & 2008 can't handle source files with identical names in different folders?

后端 未结 8 948
难免孤独
难免孤独 2020-11-30 23:58

Direct Question: If I have two files with the same name (but in different directories), it appears that only Visual Studio 2005 can handle this transparentl

8条回答
  •  佛祖请我去吃肉
    2020-12-01 00:39

    The %(RelativeDir) solution only works for Visual Studo 2010.

    For Visual Studio 2008 you need to right click on each duplicate .cpp filename and choose "Properties". It may not be obvious but you can actually modify the "Configuration Properties -> C/C++ -> Ouptut Files" section for each individual file.

    Add a sub folder to the "Object File Name" setting of each of the duplicate .cpp files, note that .h files do not need to be modified as the .cpp file determines the .obj file output.

    For example, if your project has two conflicting files:

    internal\example.cpp base\example.cpp

    You would set the "Object File Name" for each to:

    $(IntDir)\internal\ $(IntDir)\base\

    You will need to do this for all configurations Release/Debug etc.

提交回复
热议问题