C ++/CLR受管单元测试有链接器错误 [英] C++/CLR managed unit test has linker errors
本文介绍了C ++/CLR受管单元测试有链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在将任何托管类包含到我的托管单元测试中时,编译会吐出以下错误:
When including any managed class to my managed unit test the compile spits out these errors:
1>UnitTest.obj : error LNK2020: unresolved token (0A000360) "extern "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPB_WH00ZZ)
1>UnitTest.obj : error LNK2020: unresolved token (0A000361) "extern "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPB_WH00ZZ)
1>UnitTest.obj : error LNK2028: unresolved token (0A0003E6) "extern "C" void __cdecl _invalid_parameter(wchar_t const *,wchar_t const *,wchar_t const *,unsigned int,unsigned int)" (?_invalid_parameter@@$$J0YAXPB_W00II@Z) referenced in function "public: void __thiscall std::_Iterator_base12::_Orphan_me(void)" (?_Orphan_me@_Iterator_base12@std@@$$FQAEXXZ)
1>UnitTest.obj : error LNK2019: unresolved external symbol "extern "C" void __cdecl _invalid_parameter(wchar_t const *,wchar_t const *,wchar_t const *,unsigned int,unsigned int)" (?_invalid_parameter@@$$J0YAXPB_W00II@Z) referenced in function "public: void __thiscall std::_Iterator_base12::_Orphan_me(void)" (?_Orphan_me@_Iterator_base12@std@@$$FQAEXXZ)
1>UnitTest.obj : error LNK2001: unresolved external symbol "extern "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPB_WH00ZZ)
我正在使用clr项目以及包括托管类.删除包含内容可以使测试得以编译.
I am using a clr project as well as including a managed class. Removing the include allows the test to compile.
推荐答案
要解决此问题,您必须删除
To solve this issue you must remove
"_ DEBUG"
"_DEBUG"
来自测试项目中的
[TestProject]->属性-> C/C ++->预处理程序->预处理程序 定义
[TestProject] -> Properties -> C/C++ --> Preprocessor --> Preprocessor Definitions
或者,您可以更改
从"_DEBUG"到"NDEBUG"
"_DEBUG" to "NDEBUG"
这篇关于C ++/CLR受管单元测试有链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文