Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Resolved]Qt 4.8.2 + vs2010 + static + project build issues LNK2019 (QString) & LNK2005
Qt 6.11 is out! See what's new in the release blog

[Resolved]Qt 4.8.2 + vs2010 + static + project build issues LNK2019 (QString) & LNK2005

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 7.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I had successfully compiled a static version of qt4.8.2 by following the instructions from this "post ":http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/

    configure command I used to compile Qt:
    @C:\Qt\vs2010-4.8.2-static>configure -static -debug-and-release -opensource -no-q
    t3support -qt-sql-sqlite -phonon -phonon-backend -platform win32-msvc2010@

    However, I encountered a list of compile errors from my project, LNK2019 & LNK2005 related.

    I attached the error messages at the bottom.

    For the LNK2005 related errors , I included LIBCMT at Linker->Input->Ignore Specific Default Libraries, and its related errors disappear from the error list, but is that the right way to do it?
    For the LNK2019 related errors, I couldn't resolve them, please give me some instructions.

    Here is my project settings:
    @
    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 related error messages:
    @
    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 related error messages:
    @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
    @

    [edit] Code wrappers added for clarity. Please do next time, koahnig

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      It looks like one of the library at least linked in the project is using libcmt. Did you check that you are only linking debug builds in your project?

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        [quote author="lfdm" date="1339016060"]It looks like one of the library at least linked in the project is using libcmt. Did you check that you are only linking debug builds in your project?[/quote]

        Thank you for your reply Ifdm. You are right about the LNK2005 issue. How about the LNK2019 errors? I could not resolve them.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          The default Qt project's properties created by the vs add-in was different than before, after I re-compiled the Qt source. Therefore, I copied the new properties setting from the new project to my old project, and problem solved.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt
          • Unsolved