Programming Experience: VS2010 caused by path settings cannot correctly output file bug~

Source: Internet
Author: User

Some time ago, accidentally encountered such a bug, I put the static library project is configured, compile everything is OK, but prompted a warning:

1>c:\program Files (x86) \msbuild\microsoft.cpp\v4.0\microsoft.cppbuild.targets (1153,5): Warning MSB8012: TargetName (STEREO_VC9) does not match the OutputFile attribute value () of the Library. This may cause the project to be generated incorrectly. To correct this problem, make sure that the value of the $ (OutDir), $ (TargetName), and $ (Targetext) property matches the value specified in% (Lib.outputfile).

At first did not care, and later compiled other Win32 project, to use this library, the results let me plunge glasses, I am not aware of the library, I am more strange, went to the designated path under the view, sure enough!!

What's the problem? After a "toss", did not find any errors in the place, no way, only with the correct static library project comparison, I found only one difference:

Figure 1. Normal configuration


Figure 2. Exception configuration


This is the only difference, I will write the output file as the same content "$ (OutDir) $ (TargetName) $ (targetext)", recompile, warning disappears, compile through, generate file appears!

know it, more to know why, Depending on the warning, "Destination filename stereo_vc9 does not conform to the output file of Lib", VS2010 uses a number of macros to replace important parameters or paths, like  $ (OutDir), $ (TargetName), and $ (targetext) refer to "Destination folder path", "Target file name", "Target filename suffix", respectively. , and the $ represents the value that extracts the corresponding macro. Knowing this, the reason is very clear, because of the "Configuration properties, general-Output directory," " configuration properties, general, target file name ", "Configuration properties, General-> target file name extension " is with "$ (OutDir) $ ( TargetName) $ (targetext) "is one by one corresponding to the relationship, the null nature will not output.

If you are curious, you can replace "$ (OutDir) $ (TargetName) $ (targetext)" with your own path (which must be inconsistent with the settings set in general, configuration Properties ). The result of the output may not be, the latter may be preferred, the same is true.

If you want to see what the macro value is, you can select a configuration box as follows:


Figure 3. Macro value

Perhaps this article said this bug, has long been a friend noticed, the reason is written, because do not want everyone because of this problem wasted time, too unworthy.

Programming Experience: VS2010 caused by path settings cannot correctly output file bug~

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.