开发者

CPP unit build error in VS 2010

开发者 https://www.devze.com 2023-02-19 07:00 出处:网络
I am builidng CPPunit 1.12.1using VS 2010. I able to build CPP unit successfully on VS 2008. I am building only CPPUnit library.

I am builidng CPPunit 1.12.1 using VS 2010. I able to build CPP unit successfully on VS 2008. I am building only CPPUnit library. I am getting following error. How can i fix this error.

error MSB3073: The command "copy "D:\src\cppunit\.\Debug\cppunit.lib" ..\..\lib\cppunit.lib
:VCEnd" exited with code 1. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 113 6   cppunit

I am also mentioning one of warnings which is related to error i think so.


C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1151,5): warning MSB8012: TargetPath(D:\src\cpp开发者_如何学JAVAunit\.\Debug\cppunit.lib) does not match the Library's OutputFile property value (D:\src\cppunit\Debug\cppunitd.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).


These are post-build event errors.

Right click on your project-name in Visual Studio Solution Explorer:

Properties >> Post-Build Event

Remove the text from CommandLine textbox if you don't want post-build events. Or fix the path!


The issue is that the post-build step is something like: copy "$(TargetPath)" ....\lib\$(TargetName).lib.

Since the 'TargetName' value changes depending upon the build type, go in the project properties and change the 'target name' depending upon the selected build. In your case, if you check your 'warning' carefully, you will find that you are trying to copy the cppunit.lib to the ..\lib folder when actually your expected output is supposed to be cppunitd.lib. TargetName mismatch!

Another thing that I found helpful (it may be something only I observed) was building the 'release' build first, followed by the 'debug' build.


You have the configuration slightly messed up. You are telling MSVC to create an output file in one directory and then use it from a different one - and it looks like at least one of the dirs doesn't exist.

It's nothign to do with cppunit

0

精彩评论

暂无评论...
验证码 换一张
取 消