STL / CLR的奇怪链接器问题 [英] Strange linker issues with STL/CLR

查看:70
本文介绍了STL / CLR的奇怪链接器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我对STL / CLR列表类有一个奇怪的问题。如果我声明一个int列表的句柄,我会得到以下链接器错误(如果列表只是一个嵌套对象,则编译正常):

错误LNK2020:未解析的令牌(06000058)cliext.list< int>: :克隆

我的代码重现如下:

#pragma once

#include< cliext / list> < br>
私有ref class TestClass
{
cliext :: list< int> ^ m_list;
public:
TestClass(void);
};

我确信我必须完全误解某些东西 - 我简直不敢相信因为这会导致链接器错误!我正在使用visual studio 2008,service pack 1.

我有很好的搜索,到目前为止还没有找到任何有用的东西。

提前谢谢。
< br>

解决方案

我不能回答你为什么不编译,但作为一个侧点尝试编译这个:

#include < cliext / list >
私人REF T类estClass
{
cliext :: list < int > < font style ="font-size:11px"> ^ m_list;
public:
TestClass(void)
:m_list(gcnew cliext :: list < int > ())
{}
};

Hi all, I am having a strange problem with the STL/CLR list class. I get the following linker error if I declare a handle to a list of ints (compiles fine if the list is just a nested object):

error LNK2020: unresolved token (06000058) cliext.list<int>::Clone

my code to reproduce this is as follows:

#pragma once

#include <cliext/list>

private ref class TestClass
{
    cliext::list<int> ^ m_list;
public:
    TestClass(void);
};

I am sure I must have totally misunderstood something - I can't believe that something as simple as this is causing linker errors! I am using visual studio 2008, service pack 1.

I have had quite a good search around, and haven't found anything useful so far.

Thanks in advance.

解决方案

I cannot answer you as to why it is not compiling, but just as a side point try compiling this:

#include <cliext/list> 
 
private ref class TestClass 
    cliext::list<int>^ m_list; 
public: 
  TestClass(void) 
     : m_list( gcnew cliext::list<int>() ) 
  {} 
}; 


这篇关于STL / CLR的奇怪链接器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆