Reputation: 632
I have Netbeans 7.3.1 installed with MingW. I have built several c/c++ terminal apps with this so I am pretty sure it works. My difficulty is with QT. I can't seem to get my Qt app (default main.cpp) to compile.
I installed Qt 5.1.1 for Windows 32-bit (VS 2010, 505 MB) and Qt Creator 2.8.1 for Windows (53 MB) (Info) from here http://qt-project.org/downloads.
In netbeans I created a new c++ -> qt application. On the project properties I point the c++ compiler to the qt includes root and the linker to the qt libraries. When I try to clean and build the default main.cpp: #include
int main(int argc, char *argv[]) {
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);
QApplication app(argc, argv);
return app.exec();
}
This is what I get. Not exactly sure what this error means:
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE=/C/Qt/4.8.5/bin/qmake.exe SUBPROJECTS= .clean-conf
make.exe[1]: Entering directory /c/Users/Jones/Desktop/QtApplication_1'
/C/Qt/4.8.5/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 distclean
make.exe[2]: Entering directory
/c/Users/Jones/Desktop/QtApplication_1'
rm moc_HelloWorld.cpp
rm ui_HelloWorld.h
rm build/Debug/MinGW-Windows/HelloWorld.o build/Debug/MinGW-Windows/main.o build/Debug/MinGW-Windows/moc_HelloWorld.o
rm build/Debug/MinGW-Windows/QtApplication_1_resource_res.o
rm dist/Debug/MinGW-Windows/QtApplication_1.exe
rm: cannot remove dist/Debug/MinGW-Windows/QtApplication_1.exe': No such file or directory
make.exe[2]: [distclean] Error 1 (ignored)
rm: cannot remove
qttmp-Debug.mk': No such file or directory
make.exe[2]: [distclean] Error 1 (ignored)
rm qttmp-Debug.mk
make.exe[2]: Leaving directory /c/Users/Jones/Desktop/QtApplication_1'
make.exe[1]: Leaving directory
/c/Users/Jones/Desktop/QtApplication_1'
CLEAN SUCCESSFUL (total time: 663ms)
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE=/C/Qt/4.8.5/bin/qmake.exe SUBPROJECTS= .build-conf
make.exe[1]: Entering directory /c/Users/Jones/Desktop/QtApplication_1'
/C/Qt/4.8.5/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-Windows/QtApplication_1.exe
make.exe[2]: Entering directory
/c/Users/Jones/Desktop/QtApplication_1'
c:/Qt/4.8.5/bin/uic.exe ../QtApplication_1/HelloWorld.ui -o ui_HelloWorld.h
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'../../../../Qt/4.8.5/include/QtCore' -I'../../../../Qt/4.8.5/include/QtGui' -I'../../../../Qt/4.8.5/include' -I'../../../../Qt/4.8.5/include' -I'../../../../Qt/4.8.5/include/ActiveQt' -I'.' -I'.' -I'nbproject' -I'.' -I'../../../../Qt/4.8.5/mkspecs/win32-g++' -o build/Debug/MinGW-Windows/HelloWorld.o ../QtApplication_1/HelloWorld.cpp
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'../../../../Qt/4.8.5/include/QtCore' -I'../../../../Qt/4.8.5/include/QtGui' -I'../../../../Qt/4.8.5/include' -I'../../../../Qt/4.8.5/include' -I'../../../../Qt/4.8.5/include/ActiveQt' -I'.' -I'.' -I'nbproject' -I'.' -I'../../../../Qt/4.8.5/mkspecs/win32-g++' -o build/Debug/MinGW-Windows/main.o main.cpp
C:/Qt/4.8.5/bin/moc.exe -DUNICODE -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'../../../../Qt/4.8.5/include/QtCore' -I'../../../../Qt/4.8.5/include/QtGui' -I'../../../../Qt/4.8.5/include' -I'../../../../Qt/4.8.5/include' -I'../../../../Qt/4.8.5/include/ActiveQt' -I'.' -I'.' -I'nbproject' -I'.' -I'../../../../Qt/4.8.5/mkspecs/win32-g++' -D_GNUC_ -DWIN32 ../QtApplication_1/HelloWorld.h -o moc_HelloWorld.cpp
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'../../../../Qt/4.8.5/include/QtCore' -I'../../../../Qt/4.8.5/include/QtGui' -I'../../../../Qt/4.8.5/include' -I'../../../../Qt/4.8.5/include' -I'../../../../Qt/4.8.5/include/ActiveQt' -I'.' -I'.' -I'nbproject' -I'.' -I'../../../../Qt/4.8.5/mkspecs/win32-g++' -o build/Debug/MinGW-Windows/moc_HelloWorld.o moc_HelloWorld.cpp
windres -i QtApplication_1_resource.rc -o build/Debug/MinGW-Windows/QtApplication_1_resource_res.o --include-dir=. -DUNICODE -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
g++ -mthreads -Wl,-subsystem,windows -o dist/Debug/MinGW-Windows/QtApplication_1.exe build/Debug/MinGW-Windows/HelloWorld.o build/Debug/MinGW-Windows/main.o build/Debug/MinGW-Windows/moc_HelloWorld.o -L'c:/Qt/4.8.5/lib' -lmingw32 -lqtmaind build/Debug/MinGW-Windows/QtApplication_1_resource_res.o -lQt3Support4 -lQt3Supportd4 -lQtCLucene4 -lQtCLucened4 -lQtCore4 -lQtCored4 -lQtDeclarative4 -lQtDeclaratived4 -lQtDesigner4 -lQtDesignerComponents4 -lQtDesignerComponentsd4 -lQtDesignerd4 -lQtGui4 -lQtGuid4 -lQtHelp4 -lQtHelpd4 -lQtMultimedia4 -lQtMultimediad4 -lQtNetwork4 -lQtNetworkd4 -lQtOpenGL4 -lQtOpenGLd4 -lQtScript4 -lQtScriptTools4 -lQtScriptToolsd4 -lQtScriptd4 -lQtSql4 -lQtSqld4 -lQtSvg4 -lQtSvgd4 -lQtTest4 -lQtTestd4 -lQtWebKit4 -lQtWebKitd4 -lQtXml4 -lQtXmlPatterns4 -lQtXmlPatternsd4 -lQtXmld4 -lphonon4 -lphonond4 -lQtGuid4 -lQtCored4
Warning: .drectve /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /FAILIFMISMATCH:"_MSC_VER=1600" /FAILIFMISMATCH:"_ITERATOR_DEBUG_LEVEL=2" /DEFAULTLIB:"msvcprtd" /DEFAULTLIB:"MSVCRTD" /DEFAULTLIB:"OLDNAMES" ' unrecognized
c:/Qt/4.8.5/lib/qtmaind.lib(tmp/obj/debug_shared/qtmain_win.obj):(.text[?realloc@?$QVector@PAD@@AAEXHH@Z]+0x19): undefined reference to
__security_cookie'
c:/Qt/4.8.5/lib/qtmaind.lib(tmp/obj/debug_shared/qtmain_win.obj):(.text[?realloc@?$QVector@PAD@@AAEXHH@Z]+0x240): undefined reference to _CxxThrowException@8'
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: c:/Qt/4.8.5/lib/qtmaind.lib(tmp/obj/debug_shared/qtmain_win.obj): bad reloc address 0x240 in section
.text[?realloc@?$QVector@PAD@@AAEXHH@Z]'
collect2.exe: error: ld returned 1 exit status
make.exe[2]: * [dist/Debug/MinGW-Windows/QtApplication_1.exe] Error 1
make.exe[2]: Leaving directory /c/Users/Jones/Desktop/QtApplication_1'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory
/c/Users/Jones/Desktop/QtApplication_1'
make.exe": * [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 5s)
I also added the path C:\Qt\4.8.5 to the environment variables and restarted the workstation several times. Still no luck.
My workstation is running windows 7 64 bit service pack 1.
Upvotes: 0
Views: 958
Reputation: 25155
You installed Qt for MSVC 2010 but are using MingW as compiler. That won't work. The C++ ABIs of MingW and MSVC are incompatible, thus they cannot be mixed. Thus all C++ libraries (and the main executable) linked together must be built with the same compiler/compiler family. (This does not affect C libraries). You need to either use MSVC or install Qt for MingW.
Upvotes: 1