Qt 4.8.2 + vs2010 +静态+项目构建问题LNK2019& LNK2005

时间:2012-06-05 09:47:00

标签: visual-c++ qt4 linker-errors static-linking

我已按照此帖http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/

中的说明成功编译了qt4.8.2的静态版本

但是,我在编译项目时遇到了错误列表,它们是LNK2019& LNK2005相关。

我在底部附上了错误消息。

对于与LNK2005相关的错误,我在链接器中包含LIBCMT->输入 - >忽略特定默认库,其相关错误从错误列表中消失,但这是正确的方法吗?

对于与LNK2019相关的错误,我无法解决,请给我一些指示。

这是我的项目设置:

C/C++ -> Code Generation -> Runtime Library: Multi-threaded Debug (/MTd)

C/C++ -> Language -> Treat WChar_t As Built in Type: No ( /Zc:wchar_t- )

Linker-> Input -> Additional Dependencies:

Imm32.lib
Ws2_32.lib
winmm.lib
qtmaind.lib
QtCored.lib
QtGuid.lib
wsock32.lib

LNK2019相关错误消息:

- Error 161 error LNK2019: unresolved external symbol
   "__declspec(dllimport) public: class std::basic_string<char,struct
   std::char_traits<char>,class std::allocator<char> > __thiscall
   QString::toStdString(void)const "
   (__imp_?toStdString@QString@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
   referenced in function "private: void __thiscall
   MainForm::on_actionConfiguration_triggered(void)"
   (?on_actionConfiguration_triggered@MainForm@@AAEXXZ) C:\Working\ProjLocation\test\mainform.obj   test

 - Error    163 error LNK2019: unresolved external symbol
   "__declspec(dllimport) public: class QString & __thiscall
   QString::append(char const *)" (__imp_?append@QString@@QAEAAV1@PBD@Z)
   referenced in function "private: void __thiscall
   MainForm::summaries_series(struct series const *)"
   (?summaries_series@MainForm@@AAEXPBUseries@@@Z)  C:\Working\ProjLocation\test\mainform.obj   test

 -  Error   162 error LNK2019: unresolved external symbol
   "__declspec(dllimport) public: __thiscall QString::QString(char const
   *)" (__imp_??0QString@@QAE@PBD@Z) referenced in function "private: void __thiscall MainForm::on_actionLogin_triggered(void)"
   (?on_actionLogin_triggered@MainForm@@AAEXXZ) C:\Working\ProjLocation\test\mainform.obj   test

LNK2005相关错误消息:

- Error 12 error LNK2005: __set_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj) C:\Working\ProjLocation\test\LIBCMT.lib(invarg.obj) test

<more LIBCMT & LIBCMTD related errors…..>

- Error 17 error LNK2005: “void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)” (?_invalid_parameter@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj) C:\Working\ProjLocation\test\LIBCMT.lib(invarg.obj) test

1 个答案:

答案 0 :(得分:0)

在重新编译Qt源之后,vs加载项创建的默认Qt项目属性已更改。