Creating / using the CppUnit library on VS2010

I compiled and compiled CppUnit to compile with Visual Studio 2010.

After the conversion, I was able to load CppUnitLibraries and it gives me cppunit.lib and cppunit_dll.lib / dll. After copying the headers and libraries to the directory, I run this command to get a lot of errors.

I found the library conflict as follows

LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library

However, the following command does not work.

cl main.cpp complex.cpp testset.cpp /I"C:\CppUnit\include" /link /libpath:"C:\CppUnit\lib" cppunit.lib /NODEFAULTLIB:library

What is wrong with them?

This is the command I used to compile / link.

cl main.cpp complex.cpp testset.cpp /I"C:\CppUnit\include" /link /libpath:"C:\CppUnit\lib" cppunit.lib

This is the error message VS2010.

cppunit.lib (TestResult.obj): error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': 

...

node @ @@ Z) already defined in LIBCMT.lib (typinfo.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:lib
rary
main.exe : fatal error LNK1169: one or more multiply defined symbols found

ADDED

CppUnit (dsw), 2010 .

/MD . /EHsc.

cl /EHsc /MD /c /I"./CppUnit/include" main.cpp testset.cpp complex.cpp
link /libpath:"CppUnit/lib" main.obj testset.obj complex.obj cppunit.lib /out:cpptest_static.exe
link /libpath:"CppUnit/lib" main.obj testset.obj complex.obj cppunit_dll.lib /out:cpptest_dynamic.exe
+3
3

, CppUnit , . .

, , VS , CppUnit.

: (, , /MD- aka Multi-Threaded DLL)

+2

CPPUNIT visual studio 2010 . , .

cppunit_dll :

copy "$(TargetPath)" ..\..\lib\$(TargetName).dll
copy "$(TargetDir)$(TargetName).lib" ..\..\lib\$(TargetName).lib

$(TargetName) - "cppunit_dll".

, : Linker, , - "cppunitd_dll.dll".

, , ConfigurationPropertys\General "Target Name" $(ProjectName) "cppunitd_dll".

cppunit.

+1

INSTALL-VS.Net2008.txt cppunit SVN.

: .

... vs2010 . "cmd.exe" dll.

0

Source: https://habr.com/ru/post/1784752/


All Articles