我安装了带有 MingW 的 Netbeans 7.3.1。我已经用它构建了几个 c/c++ 终端应用程序,所以我很确定它可以工作。我的困难在于QT。我似乎无法编译我的 Qt 应用程序(默认 main.cpp)。
我从这里http://qt-project.org/downloads安装了适用于 Windows 32 位(VS 2010,505 MB)的 Qt 5.1.1 和适用于 Windows 的 Qt Creator 2.8.1(53 MB)(信息)。
在 netbeans 中,我创建了一个新的 c++ -> qt 应用程序。在项目属性上,我将 c++ 编译器指向 qt,包括 root 和指向 qt 库的链接器。当我尝试清理和构建默认的 main.cpp 时:#include
int main(int argc, char *argv[]) {
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);
QApplication app(argc, argv);
return app.exec();
}
这就是我得到的。不完全确定此错误的含义:
"/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 ]: 进入目录/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] 错误 1(忽略)rm qttmp-Debug.mk make.exe[2]:离开目录/c/Users/Jones/Desktop/QtApplication_1'
make.exe[1]: Leaving directory
/c/Users/Jones/Desktop/QtApplication_1'
清洁成功(总时间: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 ]: 进入目录/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'../.8../../Qt 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'nbproject' -我'。-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_SUPAINPORT -DQT_THREAD_SUPAINPORT -DQT./ ./../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'nbproject' -我'。-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'../.8../5./Qt4包括/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'nbproject' -我'。-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_MMX 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'nbproject' -我'。-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 构建/调试/MinGW-Windows/QtApplication_1_resource_res.o --include-dir=。/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):未定义对_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 的引用:错误:ld 返回 1 退出状态 make.exe[2]:* [dist/Debug/MinGW-Windows/QtApplication_1 .exe] 错误 1 make.exe[2]: 离开目录/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] 错误 2
BUILD FAILED(退出值2,总时间:5s)
我还在环境变量中添加了路径 C:\Qt\4.8.5 并多次重新启动工作站。仍然没有运气。
我的工作站正在运行 Windows 7 64 位服务包 1。