环境:vs 2008 , qt 4.4.2 
我用vs2008 的qt 类库模版新建了一个项目,在生成的类里添加了一个SayHi方法,返回字符串“hello world!”, 编译,连接成功,生成Settings.lib,然后我新建了一个控制台项目,添加相应的include,lib ,在main方法里new了一个Settings ,然后编译就出错了:
- 错误    1    error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall Settings::Settings(void)" (__imp_??0Settings@@QAE@XZ),该符号在函数 _main 中被引用    main.obj    JustDoIt
 
相关代码:
类库:
settings_global.h:
- #ifndef SETTINGS_GLOBAL_H
 - #define SETTINGS_GLOBAL_H
 - #include <Qt/qglobal.h>
 - #ifdef SETTINGS_LIB
 - # define SETTINGS_EXPORT Q_DECL_EXPORT
 - #else
 - # define SETTINGS_EXPORT Q_DECL_IMPORT
 - #endif
 - #endif // SETTINGS_GLOBAL_H
 
settings.h:
- #ifndef SETTINGS_H
 - #define SETTINGS_H
 - #include "settings_global.h"
 - class QString;
 - class SETTINGS_EXPORT Settings
 - {
 - public:
 -     QString SayHi();
 -     Settings();
 -     ~Settings();
 - };
 - #endif // SETTINGS_H
 
settings.cpp:
- #include "settings.h"
 - #include <Qstring>
 - QString Settings::SayHi()
 - {
 -     return QString("Hello world");
 - }
 - Settings::Settings(){}
 - Settings::~Settings(){}
 
另外一个console项目:
main.cpp
- #include "settings.h"
 - int main(int argc , char ** argv)
 - {
 -     Settings * config = new Settings();
 - }
 
老大们,这是为什么啊? 如果信息不够详细,难以找到原因,能不能写一个最简单的类库和调用它的项目让我看看阿?不胜感激!