Failed to use C++ Rest SDK and Microsoft unit test at the same time -
Failed to use C++ Rest SDK and Microsoft unit test at the same time -
i have mfc project uses c++ rest sdk (casablanca
) under visual studio 2012 implement http client connection , can compiled well. add together microsoft unit test project, can’t build unit test project successfully. in main project, environment set “use mfc in static library”, “no mutual language runtime support” , “multi-threaded debug (/mtd).” , test project’s environment same main project. error message shows:
“error lnk2005: "void * __cdecl operator new[](unsigned int)" (??_u@yapaxi@z) defined in libcpmtd.lib(newaop.obj).”
in addition, seek alter test project’s environment “common language runtime back upwards (/clr)” , “multi-threaded debug dll (/mdd).” original error disappears new error comes:
“error c1189: #error : not supported when compiling /clr or /clr:pure. c:\program files (x86)\microsoft visual studio 11.0\vc\include\atomic line 9”
i not know how overcome these problems. can please give me suggestions or resolutions? thanks.
the crt libraries utilize weak external linkage new, delete functions. mfc libraries contain new, delete functions. these functions require mfc libraries linked before crt library linked. please check http://support.microsoft.com/kb/148652
solution based on vs2005:
go project>properties>configuration properties>linker>input
add "additional dependency" -> nafxcwd.lib libcmtd.lib
add "ignore specific library" -> nafxcwd.lib;libcmtd.lib
c++ unit-testing visual-studio-2012 mfc
Comments
Post a Comment