1.Ubuntu18 安裝qt編譯生成的程式檔案型別為application/x-sharedlib,無法雙擊直接執行。檔案型別應該為x-executable。

2.解決方法

在.pro檔案中新增下面內容後,刪除以前編譯檔案,重新編譯,生成執行檔案。

QMAKE_LFLAGS += -no-pie

參考:https://stackoverflow.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