MSB8027: Two or more files with the name of ***. cpp will produce outputs to the same location .,

Source: Internet
Author: User

MSB8027: Two or more files with the name of ***. cpp will produce outputs to the same location .,

Link: http://www.setoreaustralia.com/msb8027-two-or-more-files-with-the-name-of-texture-cpp-will-produce-outputs-to-the-same-location/

Another "pleasure" of development in the VC ++ environment ". Although it seems that nothing can cause problems, directly Porting some * nix code will never run perfectly. When porting an AR system (spatial augmented reality system), we have two Texture. cpp (one for the real environment texture and the other for the virtual target texture) are located in different subdirectories, but VC ++ compiler does not like to accept this situation:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(942,5): warning MSB8027: Two or more files with the name of Texture.cpp will produce outputs to the same location. This can lead to an incorrect build result.  The files involved are src\geometry\Texture.cpp, src\graphics\Texture.cpp.

The program will continue to compile, but at last there will always be errors when it contains the error file or access the error category!

In fact, this is not a new Bug. This problem occurs in the timeline provided by Microsoft Connect below, and it was originally planned to be solved in Visual Studio 2013 Update 1 (I am currently using Update 3, but it is not solved yet !) : Https://connect.microsoft.com/VisualStudio/feedback/details/797460/incorrect-warning-msb8027-reported-for-files-excluded-from-build

Solution

By default, all source files (object files) are output to the same directory when VC ++ compiles the source files, and the source files with the same name overwrite the previous object files with the same name. To solve this problem, you can set the output path to be similar to the source file path. The following operations are applicable to Visual Studio 2013 (Update 3:

Right-click the project and choose Properties> Configuration Properties> C/C ++> output file> object file name. Change $ (IntDir) to $ (IntDir)/% (RelativeDir) /.

After the configuration is complete, the output path of the compilation stage takes into account the source file path rather than the source file name.

Wish you success!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.