1

I am developing an application with Qt Creator and I'm getting this message

undefined reference to `_imp___ZN7QWidget14setWindowTitleE7QString'

Are there any modules or headers that I should include to remove this error message?

Edit:

The version I'm using is Qt 5.8.0 (MSVC 2015, 32 bit)

The .pro file:

QT       += core gui serialport multimedia widgets

TARGET = Prototype
TEMPLATE = app

SOURCES += main.cpp\
        mainwindow.cpp \
    patientselect.cpp

HEADERS  += mainwindow.h \
    patientselect.h

FORMS    += mainwindow.ui \
    patientselect.ui

RESOURCES += \
    resources.qrc
G.Hajj
  • 31
  • 1
  • 7
  • That seems more like a library that isn't being linked to –  May 06 '17 at 12:51
  • 2
    @CodyGray that [What is an undefined reference](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) page has no info on how to do that in Qt Creator – Pavel P May 06 '17 at 15:00
  • 1
    Actually it's a particular Qt question (rather than a general Q about undefined symbols at linker stage) and it's answered perfectly. I don't think it should be marked as duplicate. – AndreyS Scherbakov Oct 28 '17 at 04:52

2 Answers2

2

You need to link with Qt5Widgets if you are using Qt5.

The Qt Widgets module is not linked by default and has to be specified in your .pro file with:

QT += widgets.

Pavel P
  • 15,789
  • 11
  • 79
  • 128
1

First, this is not a compiler problem but a linker problem. It happens because some libraries are forgotten be to added when building your application. Adding a new header to your include won't help.

Try: check your .pro file, does it have something like:

QT = core gui

Check this link.

kbridge4096
  • 901
  • 1
  • 11
  • 22