Ubuntu21 系统qt生成程序无法双击运行问题

作者: shaoliang 2022-03-14 06:16   访问数:827

        Ubuntu21 系统qt生成程序无法双击运行问题

只能通过命令行运行

                                                 

#-------------------------------------------------
#
# Project created by QtCreator 2022-03-13T19:27:42
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = tt1
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as 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 you use 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 += \
        main.cpp \
        widget.cpp

HEADERS += \
        widget.h

FORMS += \
        widget.ui

QMAKE_LFLAGS += -no-pie


pro文件最后加上

解决方法

  在.pro文件中添加下面内容后,删除以前编译文件,重新编译,生成执行文件。


QMAKE_LFLAGS += -no-pie



鲁ICP备19029146号-1 管理
CopyRight@51dr.top 页面打开时间 0.0311 秒.