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

时间:2023-03-08 16:50:51

1.Ubuntu18 安装qt编译生成的程序文件类型为application/x-sharedlib,无法双击直接运行。文件类型应该为x-executable。

2.解决方法

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

QMAKE_LFLAGS += -no-pie

参考:https://*.com/questions/41398444/gcc-creates-mime-type-application-x-sharedlib-instead-of-application-x-applicati

To solve it on Qt/C++ GUI Applications, add the following line on the .pro file:

QMAKE_LFLAGS += -no-pie