Std的小问题,编译总是有错!
老外的SDK,自带的例程中用到了std,可是编译时有几个类总是报错:
CyAcquisitionPage.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CyChannel::CyChannel(unsigned short,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_
??0CyChannel@@QAE@GABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
CyAcquisitionPage.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __thiscall CyChannel::GetName(void)const " (__imp_?GetNa
me@CyChannel@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
CyApp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CyXMLDocument::CyXMLDocument(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0CyXMLDocument@@Q
AE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
CyDeviceDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CyXMLDocument::CyXMLDocument(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0CyXMLDocum
ent@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
CyApp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned long __thiscall CyXMLDocument::CreateDocument(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?Cre
ateDocument@CyXMLDocument@@QAEKABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
CyDeviceDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __thiscall CyAdapterID::GetIdentifier(void)const " (__imp_?Get
Identifier@CyAdapterID@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
CyDeviceDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned long __thiscall CyCameraRegistry::GetName(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)const " (__imp_?G
etName@CyCameraRegistry@@QBEKAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
好像每个都有std参数,大侠帮我看看是怎么回事啊?老外总是说他们那边编译没问题!郁闷死了
问题点数:50、回复次数:12Top
1 楼rainfall19831109(恩恩)回复于 2005-02-02 18:53:01 得分 10
看是用了DLL,你的程序里设置了LIB文件的路径没有??Top
2 楼my12121(bobo)回复于 2005-02-02 18:55:38 得分 0
设置了啊,而且我看了文件夹下面,就设置的LIB路径下面有库文件,应该没有遗漏的。
实在不知道问题出在哪里了Top
3 楼goodluckyxl(被人遗忘的狗)回复于 2005-02-02 19:02:42 得分 10
using namespace std;Top
4 楼my12121(bobo)回复于 2005-02-02 19:03:25 得分 0
加了,呜呜Top
5 楼goodluckyxl(被人遗忘的狗)回复于 2005-02-02 19:08:25 得分 10
是不是类的实现和定义分开了
Top
6 楼goodluckyxl(被人遗忘的狗)回复于 2005-02-02 19:14:57 得分 0
把实现放到和声明放到一起
或者用支持分离模型的编译器
vc6.0是不支持的
去试试 2001 errorTop
7 楼my12121(bobo)回复于 2005-02-02 19:16:57 得分 0
应该不会的啊。类的说明中头文件和库文件都不缺啊。Top
8 楼goodluckyxl(被人遗忘的狗)回复于 2005-02-02 19:18:22 得分 10
一旦实现分离了
必须使用支持分离模型的编译器
我是指STL类的话
注意看下一下
Top
9 楼my12121(bobo)回复于 2005-02-02 19:21:10 得分 0
各位大侠,我觉得是编译器设置的事情,我曾经注掉一些代码(好像是类对象声明),编译,又取消注释编译,就全部通过了。可是我现在试了很久也不知道该注掉什么了。Top
10 楼goodluckyxl(被人遗忘的狗)回复于 2005-02-02 19:26:49 得分 0
...
如果是STL对象
是在在你调用时产生实例点
才会找定义[member template Fun也样]
如果你不实例
永远都不会报错
Top
11 楼goodluckyxl(被人遗忘的狗)回复于 2005-02-02 19:28:27 得分 10
你怀疑有什么用呢
你怀疑有用
你自己都解决了
还用提问么
你检查一下是否是这个问题
Top
12 楼my12121(bobo)回复于 2005-02-02 19:35:07 得分 0
唉,出来了居然。我不明白是为什么,我随便打开一个报错的类的头文件,注掉其中一个成员函数的return,编译,再取消注释,再编译,通过了。这是什么问题啊,怪异。。Top




