利用模板实例化解决LNK2022错误.

本文介绍了如何通过模板实例化来解决C++ CLR应用中遇到的LNK2022错误。错误源于元数据操作失败,特别是关于类型`cliext::vector<System::String ^,0>`的不一致字段声明。解决方案包括定义一个新的结构`MyClassVector`继承自`cliext::vector<MyClass^>`,或者使用`template ref class`并在预编译头文件中声明`cliext::vector<MyClass^>`。" 133334111,19974087,内部类与代理:后端开发关键技术解析,"['后端开发', 'Java', '代理']
摘要由CSDN通过智能技术生成

诸如这样的问题

http://social.msdn.microsoft.com/Forums/ar-SA/vcgeneral/thread/a4490504-956f-44d0-a39c-3a4bd36a4aac


I have the following lines of code in my header file of a C++ CLR application:


#include<cliext/vector>
using namespace cliext;
...
vector <String^>^ availVector;

I then have the following lines of code in my CPP file in a method :

availVector = gcnew vector<String^>();
availVectsr->push_pack("test");

when I tried to compile the program I get the following linker errors:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值