首页 文章

Qt:链接错误

提问于
浏览
0

我是Qt的新手,我在链接项目时遇到以下错误:

qtmain.lib(qtmain_win.obj) : error LNK2038: mismatch detected for '_MSC_VER': va
    lue '1600' doesn't match value '1700' in main.obj
    main.obj : error LNK2001: unresolved external symbol "char const * __cdecl std::
    _Winerror_map(int)" (?_Winerror_map@std@@YAPBDH@Z)
    main.obj : error LNK2001: unresolved external symbol "char const * __cdecl std::
    _Syserror_map(int)" (?_Syserror_map@std@@YAPBDH@Z)
    main.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xbad_al
    loc(void)" (?_Xbad_alloc@std@@YAXXZ)
    main.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xout_of
    _range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z)
    main.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xlength
    _error(char const *)" (?_Xlength_error@std@@YAXPBD@Z)
    main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) publ
    ic: static void __fastcall QListData::dispose(struct QListData::Data *)" (__imp_
    ?dispose@QListData@@SIXPAUData@1@@Z)
    main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) publ
    ic: static int __fastcall QApplication::exec(void)" (__imp_?exec@QApplication@@S
    IHXZ)
    moc_mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllim
    port) void __fastcall qt_assert(char const *,char const *,int)" (__imp_?qt_asser
    t@@YIXPBD0H@Z)
    mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport
    ) public: static class QString __fastcall QCoreApplication::translate(char const
     *,char const *,char const *,int)" (__imp_?translate@QCoreApplication@@SI?AVQStr
    ing@@PBD00H@Z)
    mainwindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport
    ) public: static void __fastcall QMetaObject::connectSlotsByName(class QObject *
    )" (__imp_?connectSlotsByName@QMetaObject@@SIXPAVQObject@@@Z)
    d:\c\output\main\main32.exe : fatal error LNK1120: 10 unresolved externals

这是我的链接命令:

"%VCInstallDir%\bin\link.exe" /MACHINE:X86 /LIBPATH:"%VCInstallDir%\lib"  /LIBPATH:"%VCInstallDir%\atlmfc\lib" /LIBPATH:"%WindowsSdkDir%\Lib\win8\um\%_pf%" LIBPATH:"e:\Qt\Qt5.0.2\5.0.2\msvc2010\lib" /MERGE:code=.text /errorReport:none /DEBUG /FIXED /INCREMENTAL:NO /NXCOMPAT /LTCG /MAP:"d:\c\temp\main\win32\main.map" MAPINFO:EXPORTS /NODEFAULTLIB /NOLOGO /OPT:REF /OPT:ICF /LARGEADDRESSAWARE:NO /DYNAMICBASE:NO /OUT:"d:\c\output\main\main32.exe" /MANIFESTUAC:NO /SAFESEH:NO /SUBSYSTEM:WINDOWS /VERSION:1.0 /WX /MERGE:.rdata=.text /FIXED:NO libcmt.lib kernel32.lib user32.lib advapi32.lib shlwapi.lib shell32.lib secur32.lib psapi.lib ole32.lib gdi32.lib comctl32.lib ws2_32.lib crypt32.lib wininet.lib msxml2.liboleaut32.lib netapi32.lib userenv.lib comdlg32.lib mpr.lib uuid.lib Qt5Core.libQt5Gui.lib Qt5Widgets.lib qtmain.lib libEGL.lib libGLESv2.lib "d:\c\temp\main\win32\main.obj" "d:\c\temp\main\win32\moc_mainwindow.obj" "d:\c\temp\main\win32\ui_mainwindow.obj" "d:\c\temp\main\win32\mainwindow.obj"

是否有一些丢失的库或其他依赖项?谢谢 .

1 回答

  • 1

    你不能使用用另一个版本的VS构建的Qt库 . 使用编译器编译Qt .

相关问题