當使用QT5 Creator加載一個項目並且添加新的現有文件后,無法啟動調試自啟動/調試按鈕,程序的程序或者是灰色的,如果移動鼠標上的按鈕,工具提示會顯示它說:“.pro文件無法解析”。
打開.pro文件.肯定在工程下面.
問題解決:
方法一:
把SOURCES HEADERS 參數中的 “\” 都去掉變成下邊這樣
SOURCES += main.cpp mainwindow.cpp hintdialog.cpp HEADERS += mainwindow.h hintdialog.h
- 1
- 2
- 1
- 2
方法二:
注意SOURCES HEADERS 參數中新加文件前空格數是否為4 的倍數。不是的話,不好意思,一定顯示“The .pro file could not be parsed”
正常情況(+號表示空格 )
SOURCES += main.cpp\ ++++++++mainwindow.cpp\ ++++hintdialog.cpp HEADERS += mainwindow.h\ ++++hintdialog.h
- 1
- 2
- 3
- 4
- 5
- 6
- 1
- 2
- 3
- 4
- 5
- 6
錯誤情況
SOURCES += main.cpp\ ++++++++mainwindow.cpp\ ++++hintdialog.cpp 這里hintdialog.h前有5個空格是不對的。 HEADERS += mainwindow.h\ +++++hintdialog.h