Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QString linking error with visual studio 2013 ( nmake tool ) and Qt 5.4
QtWS25 Last Chance

QString linking error with visual studio 2013 ( nmake tool ) and Qt 5.4

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 3.4k Views
  • 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.
  • C Offline
    C Offline
    CroCo
    wrote on 30 Jan 2015, 06:45 last edited by
    #1

    I'm getting linking error with QString even with simple code like the following

    @#include <QString>

    int main()
    {
    QString str;

    return 0;
    }@

    This is the .pro

    @QT += core
    QT -= gui

    TEMPLATE = app
    TARGET = test
    CONFIG += console debug
    SOURCES += main.cpp@

    I'm using Visual Studio 2013 and Qt 5.4. This is the error

    @Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
    Copyright (C) Microsoft Corporation. All rights reserved.

        "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe" -f Makefile.Debug
    

    Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
    Copyright (C) Microsoft Corporation. All rights reserved.

        cl -c -nologo -Zm200 -Zc:wchar_t -FS -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\test.pdb -DUNICODE -DWIN32
    

    I"......\Qt\5.4\msvc2013_64\include" -I"......\Qt\5.4\msvc2013_64\include\QtCore" -I"debug" -I"......\Qt\5.4\msvc2
    win32-msvc2013" -Fodebug\ @C:\Users\XXXX\AppData\Local\Temp\nm7B85.tmp
    main.cpp
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.
    Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST:embed /O
    xe @C:\Users\XXXX\AppData\Local\Temp\nm84F8.tmp
    main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QString::QString(void)" (
    g@@QAE@XZ) referenced in function _main
    main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QString::~QString(void)"
    ng@@QAE@XZ) referenced in function _main
    debug\test.exe : fatal error LNK1120: 2 unresolved externals
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\link.EXE"' : return code '0x460'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe"' : return code '0x2'
    Stop.@

    qmake is located in
    @C:\Qt\5.4\msvc2013_64\bin@

    and I'm using cmd for x84. Does this cause the problem?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 30 Jan 2015, 08:18 last edited by
      #2

      of course you should use the x64 command line. VS provides a shortcut for it.
      For example the one which calls:
      @
      %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"" amd64
      @
      I don't know if that's the problem though, because i would expect an other linker error. But nevertheless you must use the x64 msvc build tools when using x64 Qt binaries.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 30 Jan 2015, 08:18 last edited by
        #3

        Hi,

        Yes it does. From what you wrote, you are trying to compile a 32bit application with a 64bit Qt version

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • C Offline
          C Offline
          CroCo
          wrote on 30 Jan 2015, 08:35 last edited by
          #4

          Does it mean that Qt only supports x64 apps?

          1 Reply Last reply
          0
          • R Offline
            R Offline
            raven-worx
            Moderators
            wrote on 30 Jan 2015, 08:37 last edited by
            #5

            No, only when you download the x64 binaries of Qt. Of course there are also x86 binaries available.

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • C Offline
              C Offline
              CroCo
              wrote on 30 Jan 2015, 08:39 last edited by
              #6

              @raven-worx, when I go to the download page, there is only one link and there is a green message called "Recommended...":http://www.qt.io/download-open-source/. Where is the version that supports both?

              1 Reply Last reply
              0
              • C Offline
                C Offline
                CroCo
                wrote on 30 Jan 2015, 08:49 last edited by
                #7

                Now it is working. Thank you so much. But where is the version of Qt that supports both versions x86 and x64?

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  raven-worx
                  Moderators
                  wrote on 30 Jan 2015, 08:52 last edited by
                  #8

                  goto the downloads page (the site you posted the link). Then on top choose "Qt Offline Installers". There are the versions listed for different compilers.
                  For the msvc2013 binaries the 32bit and 64bit version are available also OpenGL and Angle variants.

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    CroCo
                    wrote on 30 Jan 2015, 08:54 last edited by
                    #9

                    Perfect! Thank you so much.

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      raven-worx
                      Moderators
                      wrote on 30 Jan 2015, 08:55 last edited by
                      #10

                      [quote author="CroCo" date="1422607745"]Now it is working. Thank you so much. But where is the version of Qt that supports both versions x86 and x64?[/quote]
                      You can run 32bit applications on a 64bit system but not vice versa.
                      So in most cases you don't need to build a 64bit version, only when you know why you have to choose 64bit. In case you don't know, go with the 32bit version ;)

                      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                      If you have a question please use the forum so others can benefit from the solution in the future

                      1 Reply Last reply
                      0

                      1/10

                      30 Jan 2015, 06:45

                      • Login

                      • Login or register to search.
                      1 out of 10
                      • First post
                        1/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved