【问题标题】:Using STL port in VS2008在 VS2008 中使用 STL 端口
【发布时间】:2010-10-10 21:04:30
【问题描述】:

我正在将我们的 C++ 代码从 eVC 4.0 移植到 Visual Studio 2008。我们的目标是 Windows Mobile 6.1,我们正在为我们的应用程序使用 Windows Mobile 6.0 SDK。

我们的代码在 eVC 4 中编译时使用了 stl 端口,我们希望尽可能继续使用 stl 端口。

有谁知道在我们的应用程序中加入 STL 端口 (5.2.1) 需要哪些步骤。我们已经在解决方案中设置了包含目录(就像我们为 eVC 4.0 项目所做的那样),但是每当我们尝试将列表 push_back 或向量插入命令与我们自己的类一起使用时,我们都会看到错误(下面)(下面是错误与我们的类“TriangleBufferElement”)。这些命令似乎确实适用于 int、double 等原生类型。

我们已确保所有类都具有正确的构造函数、复制构造函数、赋值运算符和比较运算符,并且看起来都是正确的。

有什么想法吗?

C:\Program Files\Windows CE Tools\stlport\stl/_construct.h(119) : error C2665: 'operator new' : none of the 2 overloads could convert all the argument types
1>        C:\Program Files\Windows Mobile 6 SDK\PocketPC\include\../../../Windows Mobile 6 SDK\PocketPC\Include\Armv4i/new(61): could be 'void *operator new(unsigned int,const std::nothrow_t &) throw()'
1>        while trying to match the argument list '(unsigned int, TriangleBufferElement *)'
1>        C:\Program Files\Windows CE Tools\stlport\stl/_construct.h(134) : see reference to function template instantiation 'void stlp_std::_Copy_Construct_aux<_Tp>(_Tp *,const _Tp &,const stlp_std::__false_type &)' being compiled
1>        with
1>        [
1>            _Tp=TriangleBufferElement
1>        ]
1>        C:\Program Files\Windows CE Tools\stlport\stl/_vector.h(381) : see reference to function template instantiation 'void stlp_std::_Copy_Construct<_Tp>(_Tp *,const _Tp &)' being compiled
1>        with
1>        [
1>            _Tp=TriangleBufferElement
1>        ]
1>        C:\Program Files\Windows CE Tools\stlport\stl/_vector.h(376) : while compiling class template member function 'void stlp_std::vector<_Tp>::push_back(const _Tp &)'
1>        with
1>        [
1>            _Tp=TriangleBufferElement
1>        ]
1>        c:\srcdevbranch\pointlib\dtmconverter\dtm\dtmreader\.\trianglebuffer.h(47) : see reference to class template instantiation 'stlp_std::vector<_Tp>' being compiled
1>        with
1>        [
1>            _Tp=TriangleBufferElement
1>        ]

【问题讨论】:

  • 你能在这个错误行周围添加示例代码吗?
  • 是的,并在您的错误周围加上前置/代码标签,以使其更易于阅读。

标签: c++ visual-studio-2008 stlport


【解决方案1】:

就我而言,这是由于定义了 __PLACEMENT_NEW_INLINE

【讨论】:

    【解决方案2】:

    您是否为新的编译器环境重新配置了 STLPort? Visual Studio 2008 与旧的 eVC++ 编译器完全不同。

    试试:

    
    configure evc9
    

    【讨论】:

      【解决方案3】:

      您可能应该看到的一些链接(如果还没有看到的话):

      STLPort Notes:

      您可能会遇到使用默认 SGI 节点分配器的问题。不过,我没有这样的问题。默认节点分配器非常快,所以我不建议在没有正当理由的情况下禁用它。但是,如果它引起问题,请定义 _STLP_USE_MALLOC_STLP_USE_NEWALLOC 以获得基于 malloc()new() 的裸露默认分配器。

      虽然this 的帖子说它还没有被移植到VS2008。

      【讨论】:

        猜你喜欢
        • 2011-01-25
        • 2013-01-28
        • 2010-10-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-09-12
        • 1970-01-01
        相关资源
        最近更新 更多