C ++ Qt: referência indefinida para `_imp___ZN12QApplicationC1ERiPPci '
Eu estou tentando me lembrar de algum C ++, e também aprender sobre o Qt.
Eu estou trabalhando no Windows. Eu instalei o Qt (5.1.0), o MinGW (g ++ 4.6.2), o Gnu Make (3.81).
Eu estou tentando compilar um aplicativo Qt simples. O caso mais básico é o seguinte:
#include <QtWidgets>
#include <QtGui>
int main (int argc, char* argv[]) {
QApplication app(argc, argv);
QTextStream cout(stdout);
return EXIT_SUCCESS;
}
O arquivo do projeto é:
TEMPLATE = app
TARGET = example1
INCLUDEPATH += .
# Input
SOURCES += fac1.cpp
QT += gui widgets core
Quando eu corro
qmake
ele gera o Makefile.
Mas então commake
Eu entendi isso:
C:\src\early-examples\example1>make
make -f Makefile.Release
make[1]: Entering directory `C:/src/early-examples/example1'
g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\example1.exe release/fac1.o -LC:\Qt\Qt5.1.0\\5.1.0\msvc2012_64\lib -lQt5Widgets -lQt5Gui -lQt5Core -llibEGL -llibGLESv2 -lgdi32 -luser32
release/fac1.o:fac1.cpp:(.text.startup+0x2e): undefined reference to `_imp___ZN12QApplicationC1ERiPPci'
release/fac1.o:fac1.cpp:(.text.startup+0x37): undefined reference to `_imp___ZN12QApplicationD1Ev'
collect2: ld returned 1 exit status
make[1]: *** [release\example1.exe] Error 1
make[1]: Leaving directory `C:/src/early-examples/example1'
make: *** [release] Error 2
Você pode me dizer o que está errado?