我在Qt中的静态编译在本周工作正常。我重新安装了qt,并重新编译了静态版本。此后头痛开始了。现在,即使我使用tatic版本编译。生成的exe需要Qt库。我用“依赖沃克”检查了exe。它表明所需的dll路径指向动态/共享库路径。这是我的设置
Environment:
QTDYNDIR : D:\tempinstallationfolder\Qt\dynamic
QTSTADIR : D:\tempinstallationfolder\Qt\static
Path : %QTDYNDIR%\bin;%QTDYNDIR%\qt\bin;%QTDYNDIR%\mingw\bin;
%QTSTADIR%\bin;%QTSTADIR%\qt\bin;%QTSTADIR%\mingw\bin;
我添加了mingw,qt路径 它以某种方式设法遵循动态lib的路径。我不知道我犯了哪个错误。 在这个问题上有人可以帮助我吗?。
注意:我使用的是Windows平台 - qt - 4.7.0(qt - 开源v2010.05)静态,动态到Qt-Creater =>工具=>选项=> Qt。
修改 这个来自编译输出。这些中没有提到动态路径目录。
Running build steps for project CalendarNew...
Starting: "D:/TempInstallationFolder/Qt/static/mingw/bin/mingw32-make.exe" clean -w
mingw32-make: Entering directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
D:/TempInstallationFolder/Qt/static/mingw/bin/mingw32-make -f Makefile.Release clean
mingw32-make[1]: Entering directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
del release\moc_CalendarWidget.cpp release\moc_DateSquareEditWidget.cpp release\moc_GeneralSettingsWidget.cpp release\moc_MyColorButton.cpp release\moc_MyLabel.cpp
del release\CalendarWidget.o release\DateSquare.o release\DateSquareEditWidget.o release\GeneralSettingsWidget.o release\main.o release\MyColorButton.o release\MyLabel.o release\moc_CalendarWidget.o release\moc_DateSquareEditWidget.o release\moc_GeneralSettingsWidget.o release\moc_MyColorButton.o release\moc_MyLabel.o
mingw32-make[1]: Leaving directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
D:/TempInstallationFolder/Qt/static/mingw/bin/mingw32-make -f Makefile.Debug clean
mingw32-make[1]: Entering directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
del debug\moc_CalendarWidget.cpp debug\moc_DateSquareEditWidget.cpp debug\moc_GeneralSettingsWidget.cpp debug\moc_MyColorButton.cpp debug\moc_MyLabel.cpp
del debug\CalendarWidget.o debug\DateSquare.o debug\DateSquareEditWidget.o debug\GeneralSettingsWidget.o debug\main.o debug\MyColorButton.o debug\MyLabel.o debug\moc_CalendarWidget.o debug\moc_DateSquareEditWidget.o debug\moc_GeneralSettingsWidget.o debug\moc_MyColorButton.o debug\moc_MyLabel.o
mingw32-make[1]: Leaving directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
mingw32-make: Leaving directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
Could Not Find C:\Documents and Settings\prabhakaran\Desktop\CalendarNew-build-desktop\debug\moc_CalendarWidget.cpp
Could Not Find C:\Documents and Settings\prabhakaran\Desktop\CalendarNew-build-desktop\debug\CalendarWidget.o
The process "D:/TempInstallationFolder/Qt/static/mingw/bin/mingw32-make.exe" exited normally.
Configuration unchanged, skipping qmake step.
Starting: "D:/TempInstallationFolder/Qt/static/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
D:/TempInstallationFolder/Qt/static/mingw/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\CalendarWidget.o ..\CalendarNew\CalendarWidget.cpp
..\CalendarNew\CalendarWidget.cpp: In constructor 'CalendarWidget::CalendarWidget()':
..\CalendarNew\CalendarWidget.cpp:93: warning: 'default_String_Fontsize' may be used uninitialized in this function
..\CalendarNew\CalendarWidget.cpp:96: warning: 'lower_String_Fontsize' may be used uninitialized in this function
..\CalendarNew\CalendarWidget.cpp: In constructor 'CalendarWidget::CalendarWidget()':
..\CalendarNew\CalendarWidget.cpp:93: warning: 'default_String_Fontsize' may be used uninitialized in this function
..\CalendarNew\CalendarWidget.cpp:96: warning: 'lower_String_Fontsize' may be used uninitialized in this function
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\DateSquare.o ..\CalendarNew\DateSquare.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\DateSquareEditWidget.o ..\CalendarNew\DateSquareEditWidget.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\GeneralSettingsWidget.o ..\CalendarNew\GeneralSettingsWidget.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\main.o ..\CalendarNew\main.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\MyColorButton.o ..\CalendarNew\MyColorButton.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\MyLabel.o ..\CalendarNew\MyLabel.cpp
D:\TempInstallationFolder\Qt\static\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\CalendarNew\CalendarWidget.h -o release\moc_CalendarWidget.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\moc_CalendarWidget.o release\moc_CalendarWidget.cpp
D:\TempInstallationFolder\Qt\static\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\CalendarNew\DateSquareEditWidget.h -o release\moc_DateSquareEditWidget.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\moc_DateSquareEditWidget.o release\moc_DateSquareEditWidget.cpp
D:\TempInstallationFolder\Qt\static\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\CalendarNew\GeneralSettingsWidget.h -o release\moc_GeneralSettingsWidget.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\moc_GeneralSettingsWidget.o release\moc_GeneralSettingsWidget.cpp
D:\TempInstallationFolder\Qt\static\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\CalendarNew\MyColorButton.h -o release\moc_MyColorButton.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\moc_MyColorButton.o release\moc_MyColorButton.cpp
D:\TempInstallationFolder\Qt\static\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\CalendarNew\MyLabel.h -o release\moc_MyLabel.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\TempInstallationFolder\Qt\static\qt\include\QtCore" -I"d:\TempInstallationFolder\Qt\static\qt\include\QtGui" -I"d:\TempInstallationFolder\Qt\static\qt\include" -I"..\CalendarNew" -I"d:\TempInstallationFolder\Qt\static\qt\include\ActiveQt" -I"release" -I"." -I"d:\TempInstallationFolder\Qt\static\qt\mkspecs\win32-g++" -o release\moc_MyLabel.o release\moc_MyLabel.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o release\CalendarNew.exe object_script.CalendarNew.Release -L"d:\TempInstallationFolder\Qt\static\qt\lib" -lmingw32 -lqtmain -lQtGui4 -lQtCore4
mingw32-make[1]: Leaving directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
mingw32-make: Leaving directory `C:/Documents and Settings/prabhakaran/Desktop/CalendarNew-build-desktop'
The process "D:/TempInstallationFolder/Qt/static/mingw/bin/mingw32-make.exe" exited normally.
注意:现在我只进行了动态和静态的全新安装。它仍然能够产生相同的结果。
答案 0 :(得分:0)
您是否已将此行添加到projectname.pro文件中?
CONFIG += static
并确保在QtCreator-Projects-Build设置中,'Qt-version'指向您的静态构建?
答案 1 :(得分:0)
我不确定这是正确的答案。我做了以下更改。我不确定哪一个纠正了我的问题。
1)似乎必须有一个名为QTDIR的环境变量,它指向动态安装目录。
2)我使用“visual studio”而不是“mingw”为静态构建编译了qt库。
在这些步骤之后,我将静态和动态的绝对路径(qt-bin,lib,minwg-bin,lib)添加到路径中。
现在,我的事情很好。我没有把它作为正确答案投票。因此,有人可以给出确切的答案。