QT4.8.1采用静态qt编译,连接时报错无法解析的外部符号 QString::QString(char const *)
问题出现的情况如下。
1. 首先静态编译qt4.8.1,采用qt-everywhere-opensource-src-4.8.1.zip包。静态编译前,修改win32-msvc2008对应的qmake.conf。
修改内容为将所有的MD,MDd分别改为MT,MTd
2. 编译configure命令为
configure -debug-and-release -static -no-fast -script -scripttools -graphicssystem opengl -opengl desktop -qt-zlib -qt-libpng -qt-libtiff -qt-libjpeg -qt-libmng -platform win32-msvc2008 -declarative -mp
3. QT可以按上述过程编译完成,并且demo程序都可以正常运行。
4. 接着对qwt3d库进行编译,环境变量均和静态编译的qt路径对应,包括qmake,lib路径,include路径。编译可以完成,但连接时报错如下
qwtplot3d.lib(qwt3d_axis.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall QString::QString(char const *)" (__imp_??0QString@@QAE@PBD@Z),该符号在函数 "public: __thiscall Qwt3D::PixmapWriter::PixmapWriter(void)" (??0PixmapWriter@Qwt3D@@QAE@XZ) 中被引用
5. 之后安装Qt官方发布的编译并打包好的动态库,并将开发环境转换对对应该动态qt库的环境,qwt3d编译可以通过,不存在上述问题。
问题是,是不是我的静态qt在编译时有什么地方设置错了,导致QString::QString(char const *)的函数定义没有在静态库中实现?