0
votes

Encountering errors when trying to use Qt and C++ combination in Netbeans.

Some Specs: Windows 7; Netbeans 7.4; Qt5.1.1 with mingw48_32; Msys

Installation directories: 1. Netbeans under C:\Program Files 2. Qt5.1.1 under C:\ 3. Msys under C:\

note: I completed the Msys post-install successfully

When I added mingw with Qt toolchain, Netbeans picked on the locations correctly. I also added all the bin directories to the Environment Variables under Path

I'm running the code provided here to test my Qt installation

[from Netbeans Tutorial]https://netbeans.org/kb/72/cnd/qt-applications.html#creating

When I test my code shown below:

#include <QtGui>
#include <QApplication>
#include "HelloForm.h"

int main(int argc, char *argv[]) {
    // initialize resources, if needed
    // Q_INIT_RESOURCE(resfile);

    QApplication app(argc, argv);

    // create and show your widgets here
    HelloForm form;
    form.show();

    return app.exec();
}

I get the following errors (gist being that all key Qt files cannot be found)

"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE=/C/Qt/Qt5.1.1/5.1.1/mingw48_32/bin/qmake.exe SUBPROJECTS= .build-conf make.exe[1]: Entering directory /c/Users/Documents/NetBeansProjects/QtApplication_1' /C/Qt/Qt5.1.1/5.1.1/mingw48_32/bin/qmake.exe VPATH=. -spec win32-g++ -o qttmp-Debug.mk nbproject/qt-Debug.pro mv -f qttmp-Debug.mk nbproject/qt-Debug.mk "/C/msys/1.0/bin/make.exe" -f nbproject/qt-Debug.mk dist/Debug/MinGW_Qt-Windows/QtApplication_1.exe make.exe[2]: Entering directory/c/Users/a516579/Documents/NetBeansProjects/QtApplication_1' g++ -Wl,-subsystem,windows -mthreads -o dist/Debug/MinGW_Qt-Windows/QtApplication_1.exe build/Debug/MinGW_Qt-Windows/HelloForm.o build/Debug/MinGW_Qt-Windows/main.o build/Debug/MinGW_Qt-Windows/moc_HelloForm.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -LC:\Qt\Qt5.1.1\5.1.1\mingw48_32\lib -lQt5Widgetsd -lQt5Guid -lQt5Cored build/Debug/MinGW_Qt-Windows/QtApplication_1_resource_res.o c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lqtmaind c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgetsd c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Guid c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored collect2.exe: error: ld returned 1 exit status make.exe[2]: * [dist/Debug/MinGW_Qt-Windows/QtApplication_1.exe] Error 1 make.exe[2]: Leaving directory /c/Users/Documents/NetBeansProjects/QtApplication_1' make.exe[1]: *** [.build-conf] Error 2 make.exe[1]: Leaving directory/c/Users/Documents/NetBeansProjects/QtApplication_1' make: * [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 1s)

Can some one help?

1

1 Answers

1
votes

All

After further searching away I realized I had overlooked a very detailed and an excellent piece at Netbeans website on working with Qt5.1.1 which is a 64bit version. I realized after comparing notes that my original configuration was asking a 32bit mingw to work with a 64bit Qt5.1.1.

So here is the article that saved the rest of my night's sleep

http://wiki.netbeans.org/Talk:HowToSetup64-BitQt5WithNetBeans7.4OnWindows#How_To_Setup_64-Bit_Qt_5_With_NetBeans_7.4_On_Windows

I followed the steps as described and my Hello Qt World is working. It has been a long day.