vc6 下使用stlport5.1.3的问题
我按照网上说明和自带的文档,编译好了stlport,产生了lib文件
然后我用我的vc6编写了一个如下的测试:
#include "stdafx.h"
#include <vector>
#include <iterator>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
vector<int> V;
V.push_back(3);
V.push_back(1);
V.push_back(4);
V.push_back(1);
V.push_back(5);
V.push_back(9);
copy(V.begin(), V.end(), ostream_iterator<int>(cout, " "));
return 0;
}
然后我在我的vc的tool-option菜单里面设置好include路径和lib路径,并且把路径都移到最顶端;然后我在当前例子的工程设置里面,设置预编译宏_STLP_VERBOSE_AUTO_LINK,编译程序,出现如下错误:
--------------------Configuration: stl_test_01 - Win32 Debug--------------------
Compiling...
stl_test_01.cpp
Linking...
stl_test_01.obj : error LNK2001: unresolved external symbol "class stlpmtx_std::basic_ostream<char,class stlpmtx_std::char_traits<char> > stlpmtx_std::cout" (?cout@stlpmtx_std@@3V?$basic_ostream@DV?$char_traits@D@stlpmtx_std@@@1@A)
stl_test_01.obj : error LNK2001: unresolved external symbol "private: static void __cdecl stlpmtx_std::D__A::_M_deallocate(void *,unsigned int)" (?_M_deallocate@D__A@stlpmtx_std@@CAXPAXI@Z)
stl_test_01.obj : error LNK2001: unresolved external symbol "private: static void * __cdecl stlpmtx_std::D__A::_M_allocate(unsigned int &)" (?_M_allocate@D__A@stlpmtx_std@@CAPAXAAI@Z)
stl_test_01.obj : error LNK2001: unresolved external symbol "protected: void __thiscall stlpmtx_std::ios_base::_M_throw_failure(void)" (?_M_throw_failure@ios_base@stlpmtx_std@@IAEXXZ)
stl_test_01.obj : error LNK2001: unresolved external symbol "public: __thiscall stlpmtx_std::locale::~locale(void)" (??1locale@stlpmtx_std@@QAE@XZ)
stl_test_01.obj : error LNK2001: unresolved external symbol "public: __thiscall stlpmtx_std::locale::locale(class stlpmtx_std::locale const &)" (??0locale@stlpmtx_std@@QAE@ABV01@@Z)
stl_test_01.obj : error LNK2001: unresolved external symbol "public: class stlpmtx_std::locale::facet * __thiscall stlpmtx_std::locale::_M_use_facet(class stlpmtx_std::locale::id const &)const " (?_M_use_facet@locale@stlpmtx_std@@QBEPAVfacet@12@ABVi
d@12@@Z)
Debug/stl_test_01.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
stl_test_01.exe - 8 error(s), 0 warning(s)
然后我把预编译宏_STLP_VERBOSE_AUTO_LINK去掉,换为_STLP_DONT_USE_AUTO_LINK,并在工程的lib设置里面加上 stlportd_static.5.1.lib,编译仍然出现上面问题,我后面又尝试 使用stlportstld_static.5.1.lib, 以及两个都加,也一样出现上面的问题。
请问有没有高人知道上面的问题怎么解决?