vc6 下使用stlport5.1.3的问题

caizhenxiong 2007-08-21 12:25:02
我按照网上说明和自带的文档,编译好了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, 以及两个都加,也一样出现上面的问题。
请问有没有高人知道上面的问题怎么解决?
...全文
279 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
killercat 2008-09-12
  • 打赏
  • 举报
回复
设置 Use run-time library:Debug Multithreaded
在 Project Settings 里面
美丽海洋 2007-08-22
  • 打赏
  • 举报
回复
copy(V.begin(), V.end(), ostream_iterator<int>(cout, " "));
\
这是库里的函数?
caizhenxiong 2007-08-22
  • 打赏
  • 举报
回复
高手帮忙解决一下啊
caizhenxiong 2007-08-21
  • 打赏
  • 举报
回复
路径没有错 字符也没有问题
Daimon_near_me 2007-08-21
  • 打赏
  • 举报
回复
"error LNK2001: unresolved external symbol "
基本上都是由于LIB文件链接不正确造成的,请检查与链接有关的地方,可能路径不正确,可能
有字符写错了

16,467

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧