Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt 4.8.2 under Visual Studio: unresolved external symbol

Qt 4.8.2 under Visual Studio: unresolved external symbol

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 4 Posters 6.7k 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.
  • S Offline
    S Offline
    sonocu
    wrote on last edited by
    #1

    Hello,

    please redirect me if my question does not belong here and please ask if I missed any important information. (I'm new here.)
    I spend many days to overcome the problem of "unresolved external symbols" I get.
    As I'm a Newbie you probably have some helpful comments on where I can trace my errors to. I'm totally lost and spend days on google to solve these issues.

    Details:
    I'm using Windows 7, Visual Studio 2010 (this may be part of the problem) and Qt 4.8.2 with C++.
    Qt has been build on my machine using nmake and Visual Studio includes the addin for Qt, already.

    I try to compile an old project (still in use of Debug-Mode), which was originally build in qt3 under visual studio 2005, so I take use of Qt3Support to create a .exe-file.
    Also this project implies the use of opengl, which might also be the reason for the errors.

    What I did:

    • QTDIR is included in the enviroment variable

    • preprocessor variables were added:
      @
      WIN32
      _DEBUG
      _WINDOWS
      UNICODE
      QT_CORE_LIB
      QT_GUI_LIB
      QT_DLL
      QT_THREAD_SUPPORT
      QT3_SUPPORT@

    • libs added to linker:
      @qtmaind.lib
      QtCored4.lib
      QtGuid4.lib
      QtOpenGLd4.lib
      opengl32.lib
      glu32.lib
      QtNetworkd4.lib
      Qt3Supportd4.lib
      @

    • as additional include directories accordingly:
      $(QTDIR)\include\Debug
      $(QTDIR)\include

    Though the build is not successful, I keep receiving six errors:
    @
    error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QGLWidget::QGLWidget(class QWidget
    error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall QMouseEvent::state(void)const "
    error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QObject::setName(char const
    error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QWidget::QWidget(class QWidget
    error LNK2019: unresolved external symbol "__declspec(dllimport) public: __int64 __thiscall QIODevice::readBlock(char
    moc_GUI.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __int64 __thiscall
    error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWidget::setCaption(
    @

    So it seems that some dll-fils are not imported (correctly?). I read they would be build of the libs, so I assumed that everything should be available.
    Other suggestions I read about:
    (1) Mixed up Debug and Release libraries (does not seem to be the case here, because they all have the "d" in their name, correct?)
    (2) moc is not executed correctly (cannot be due to the observation that new moc files are gerenated every time I try to biuld.)
    (3) some missing library (?)
    (4) something went wrong during build of Qt on my machine (I don't know how to test it)
    (5) opengl is not installed properly (I assume the problem to lie in qt atm)

    Make one person happy today by answering and give me a hint.
    Remarks on how to build Qt Applications (GUI), other than using Visual Studio, are welcome!

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      If you are a newbie, as you claim, combining OpenGL, Qt3 support, and MSVC is a sure way to problems :)

      If possible, I would suggest to:

      • install QtSDK with mingw
      • try to compile your project there

      But I have never had these particular errors, so I might be giving ill advice here :)

      (Z(:^

      1 Reply Last reply
      0
      • F Offline
        F Offline
        franku
        wrote on last edited by
        #3

        Did you mix Qt Libs built with MinGW and VS? You get an Idea when using the SDK.

        This, Jen, is the internet.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sonocu
          wrote on last edited by
          #4

          Thanks for your suggestions!
          It seems that I verified that something went wrong during the build of Qt:
          Originally I downloaded a lot of files and performed the configure and nmake step. probably I did not set up the configure options probably or the files I used for installation were incomplete.
          I could not even make a Qt application with an empty GUI run, because it always stops at the Linking stage.

          So I deleted the old Version and downloaded an exe found here:
          http://qt.nokia.com/downloads/sdk-windows-cpp-offline

          After installing, I tried the simple Qt application, which now can be build. :)
          (still under visual studio)

          To make my project run I probably have to adapt some more settings inside of Visual Studio.
          Anyway I made it run under Linux, so it's probably just a matter of time and finding the correct buttons. (Testing several settings using makefiles sure does not take so long! )

          Anyway I will probably change to SDK in the longrun, as you both advised. Seems to be more comfortable.
          Thank you very much!

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            [quote author="sonocu" date="1342108088"]Thanks for your suggestions!
            It seems that I verified that something went wrong during the build of Qt:
            Originally I downloaded a lot of files and performed the configure and nmake step. probably I did not set up the configure options probably or the files I used for installation were incomplete.
            I could not even make a Qt application with an empty GUI run, because it always stops at the Linking stage.

            So I deleted the old Version and downloaded an exe found here:
            http://qt.nokia.com/downloads/sdk-windows-cpp-offline

            After installing, I tried the simple Qt application, which now can be build. :)
            (still under visual studio)

            To make my project run I probably have to adapt some more settings inside of Visual Studio.
            Anyway I made it run under Linux, so it's probably just a matter of time and finding the correct buttons. (Testing several settings using makefiles sure does not take so long! )

            Anyway I will probably change to SDK in the longrun, as you both advised. Seems to be more comfortable.
            Thank you very much![/quote]
            In case you like to compile Qt for MSVC you should not use the sources supplied with the SDK. Use then the zipped sources from "here":http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.2.zip

            Vote the answer(s) that helped you to solve your issue(s)

            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 Extensions
            • Unsolved