在发布模式下启动使用库的静态链接编译的应用程序时出错
Error when starting an application compiled with static linking of libraries in release mode
在调试模式下编译时,我的应用程序的启动和操作是可能的和成功的。此外,发布模式下的构建不会给出任何错误。
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
。
相关文章:
- 基于boost的程序的静态链接——zlib问题
- 使用gcc从静态链接的文件中查找可选符号
- 使用转换器提升 Python 问题 - 静态链接
- C++实用程序::转换在静态链接库中不起作用
- 将源中的 GLEW 与 cmake 静态链接
- 在发布模式下启动使用库的静态链接编译的应用程序时出错
- libavdevice 和 x11 的静态链接库应该以什么顺序链接?
- 静态链接启用 PIC 的库时出现链接器 PIC 错误
- 静态链接库时,收到链接器错误:找不到 -lgcc_s
- 静态链接 glibc & boost_python36 for Python extension
- 我可以在C++中配置静态链接吗?
- 协议缓冲区的静态链接会导致与现有符号冲突
- C++标准是否定义了结构中成员函数的函数内定义是否必须具有静态链接?
- 静态链接 Visual Studio dll 到动态链接的 sfml 项目
- 我可以加载与库静态链接的 dll 吗?
- 静态链接MSVC库,动态链接Qt
- C++:找不到静态链接
- OpenSSL AES仅适用于某些计算机,即使具有静态链接也是如此
- CURL 静态链接未解析的外部符号
- 如何强制Windows.h在Visual Studio中静态链接而不是动态链接?