0

I cannot understand why this Qt pro file does not work:

QT += core
QT += gui

TARGET = PrjName
CONFIG += qt
CONFIG += console

TEMPLATE = app

INCLUDEPATH += C:/Qt/4.8.4/include/Qt
QMAKE_LIBDIR += C:/Qt/4.8.4/bin
LIBS += -lQtCore4
LIBS += -lQtGui4

SOURCES += ...

HEADERS += ...

These are the linker errors:

error: cannot find -lQtGui
error: cannot find -lQtCore

The C:\Qt\4.8.4\bin directory exists, and the DLLs are there.

Thank you.

Platform: Windows 7, MinGW, Qt 4.8.4, QtCreator 2.8.0

Pietro
  • 12,086
  • 26
  • 100
  • 193
  • 1
    You don't need to specify -lQtCore4 libraries, it's done automagically with "QT += core gui". Remove the those two lines with -lQtCore4 and -lQtGui4 and carry on. Read more about it in the [QtDocumentation](http://qt-project.org/doc/qt-4.8/qmake-project-files.html#declaring-qt-libraries). – Son-Huy Pham Jul 23 '13 at 19:02
  • 1
    Also the INCLUDEPATH and QMAKE_LIBDIR lines are not necessary. – Frank Osterfeld Jul 23 '13 at 20:39
  • @Huytard: you are right, removing those lines it behaves just like before. However the errors are still there. – Pietro Jul 24 '13 at 08:25
  • @FrankOsterfeld: the same applies to your suggestion; same behaviour. – Pietro Jul 24 '13 at 08:26
  • Did you download the wrong Qt package? If you install the MSVC package but then try to build with GCC (mingw), or vice versa, then this happens. – Nikos C. Jul 24 '13 at 09:34
  • @NikosC.: I forgot to mention it, but I am working with MinGW. – Pietro Jul 24 '13 at 09:40
  • 1
    Do you use the mingw version that comes with Qt? Or do you use your own? If it's your own, then this might explain it due to version differences in the compiler. – Nikos C. Jul 24 '13 at 09:44
  • @NikosC.: I noticed that in my QtCreator/Qt4 directory there is no MinGW executable. The one used is in C:\MinGW\bin, version 4.6.2. On the other hand, in the Qt5 directory it is present (but I am not using Qt5, yet). Could it depend from the way I installed Qt4/QtCreator? – Pietro Jul 25 '13 at 15:54

0 Answers0