在发布模式下启动使用库的静态链接编译的应用程序时出错



在调试模式下编译时,我的应用程序的启动和操作是可能的和成功的。此外,发布模式下的构建不会给出任何错误。

21:45:27: Launch: "D:TTTTTTTTTTTTTTTTTTTTTTTTTTTqtToolsmingw730_64binmingw32-make.exe" -j4
D:TTTTTTTTTTTTTTTTTTTTTTTTTTTqt5.12.7mingw73_64binqmake.exe -o Makefile ..BB.pro -spec win32-g++ "CONFIG+=qtquickcompiler"
D:/TTTTTTTTTTTTTTTTTTTTTTTTTTT/qt/Tools/mingw730_64/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Users/**/Desktop/gl/2/BattleShips/build-B-Desktop_Qt_5_12_7_MinGW_64_bit-Release'
mingw32-make[1]: Nothing to be done for 'first'.
mingw32-make[1]: Leaving directory 'C:/Users/**/Desktop/**/2/BattleShips/build-B-Desktop_Qt_5_12_7_MinGW_64_bit-Release'
21:45:29: Process"D:TTTTTTTTTTTTTTTTTTTTTTTTTTTqtToolsmingw730_64binmingw32-make.exe" ended normally.
21:45:29: Time has passed: 00:02.

我专注于:

mingw32-make[1]: Nothing to be done for 'first'.

它是什么,它有什么作用?

但是当我运行(伪(构建的应用程序时,我得到:

21:25:57: Starting C:Users**Desktop**2BattleShipsbuild-B-Desktop_Qt_5_12_7_MinGW_64_bit-ReleasereleaseB.exe ...
21:25:57: The process was ended forcefully.
21:25:57: C:Users**Desktop**2BattleShipsbuild-B-Desktop_Qt_5_12_7_MinGW_64_bit-ReleasereleaseB.exe crashed.

当我尝试从资源管理器手动运行构建的应用程序时,我收到典型的链接错误(好像使用了库的动态链接(

Qt5core.dll can not be found

另一个是关于缺乏一些 GCC 库。

我想我的 .pro 文件有问题。 是这样的:

static {
CONFIG += static
QT += core gui network widgets
DEFINES += STATIC
message("Static build.")
}
CONFIG +=  static -std=c++2a
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
SOURCES += 
battlefield.cpp 
image.cpp 
main.cpp 
player.cpp 
server.cpp 
window.cpp
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
FORMS += 
window.ui
HEADERS += 
includes.h 
player.h 
window.h

IDE:Windows 10 + qt 5.12.0 + mingw7.3.0 64位提供qt。

如何正确构建和启动此应用程序的任何建议?

两件事:Qt文件需要在PATH中,Qt必须能够找到它的插件。

您可以启动命令提示符并运行以下命令:

SET PATH=<qt_path>bin:$PATH
SET QT_PLUGIN_PATH=<qt_path>plugins

,然后从同一命令提示符运行已编译.exe

最新更新