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. LNK2019 in Debug but not in Release
Forum Updated to NodeBB v4.3 + New Features

LNK2019 in Debug but not in Release

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.0k 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.
  • E Offline
    E Offline
    enforcer
    wrote on last edited by
    #1

    I installed the latest Qt SDK (Qt 5.0.2). I'm using Qt Creator 2.7 which uses msvc2012 64-bit.

    I created a project without UI-File. in MainWindow I only added my self-defined class derived by QWidget.

    I used a class (Painting) from a book which teaches Qt. I wanted to try out the paintEvent(QPaintEvent *event) function. When I run it in debug-mode, I get LNK2019 caused by Painting constructor in function MainWindow::MainWindow. I tried to run it in release-mode and the program executed normally without any errors.

    Can someone explain why a linker error occures in debug but not in release mode?

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      LNK2019 means the linker can't find a library.

      You'll need to provide more details about the error. Which library is it trying to find?

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • E Offline
        E Offline
        enforcer
        wrote on last edited by
        #3

        bq. mainwindow.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __cdecl FormationWidget::FormationWidget(class QWidget *)" (??0FormationWidget@@QEAA@PEAVQWidget@@@Z)" in Funktion ""public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)".

        it's german:
        "Verweis auf nicht aufgelöstes externes Symbol "
        "unresolved external symbol"

        "in Funktion"
        "in function"

        For more information here is my simple code:

        formationwidget.cpp
        @FormationWidget::FormationWidget(QWidget *parent): QWidget(parent), x(0), y(0), lm(0)
        {
        resize(400,300);
        }@

        x, y and lm are of type "int"

        mainwindow.cpp
        @MainWindow::MainWindow(QWidget *parent): QMainWindow(parent)
        {
        fw = new FormationWidget(this);
        }@

        fw is of type "FormationWidget"

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          try to clean and rebuild your project.

          --- 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
          • E Offline
            E Offline
            enforcer
            wrote on last edited by
            #5

            I tried it many times, but still...

            I checked the whole folder where Qt 5.0.2 was installed, and there are debug files in both bin and lib (Qt5Guid.dll, Qt5Guid.lib).

            1 Reply Last reply
            0
            • JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              Hmm... very strange. Can you post your .pro file?

              Also, open Qt Creator and go to Tools -> Options -> Build & Run -> Kits. What kits do you have? Do the settings look correct? Is there a yellow/red warning icon?

              Then, open your project, and click on "Projects" on the left (below "Debug", above "Help). Does the selected kit match your compiler?

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              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