我正在努力将我们的 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 项目所做的那样),但是每当我们尝试对我们自己的类使用 list push_back 或 vector insert 命令时,我们都会看到错误(如下)(以下是错误与我们的类(class)“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> ]
最佳答案
一些您可能应该看到的链接(如果还没有看到的话):
You may experience problems with default SGI node allocator. I had no such problems, though. Default node allocator is quite fast, so I wouldn't recommend disabling it without serious reason. However, if it causes problems, define
_STLP_USE_MALLOC
or_STLP_USE_NEWALLOC
to get baremalloc()
-based ornew()
-based default allocator.
虽然this帖子说它还没有移植到 VS2008。
关于c++ - 在 VS2008 中使用 STL 端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/603973/