1

Main.cpp

#include <QApplication>
int main (int argc, char* argv[]) {
    QApplication app(argc, argv);

    return app.exec();
}

test.pro

SOURCES += \
    main.cpp
greaterThan(QT_MAJOR_VERSION,4) : QT +=widgets

outputs :

enter image description here

I can't compile my project because of "undefined reference to", it seems that my compiler doesn't find "QApplication" but i don't know how to solve it. I unistall and reinstall my Qt but it didn't fix it.

Clément
  • 75
  • 7
  • 1
    Is this your full `test.pro`? Did you add the proper type for your application? It seems that it's looking for WinMain and not main, which means bad setup. – Matthieu Brucher Nov 26 '18 at 10:00
  • You need to add the according libraries, not just the includes, to your linker commandline. Also, make sure that you do a little research on the error message before asking next time, because this isn't an uncommon error! – Ulrich Eckhardt Nov 26 '18 at 10:04
  • yes, it is, I found my problem that the compiler was 64 bit compiler, i selected my 32 bit compiler and i don't match any error .... – Clément Nov 26 '18 at 10:11

1 Answers1

0

Check complier type 'MinGW 64-bit'.
You can change type: Projects->Build & Run 64-bit or 32-bit (target devices)

Link:Qt Creator

Shaiful Islam
  • 335
  • 2
  • 12