QTCreator g++.exe: fatal error: no input files (Windows)

QTCreator g++.exe: fatal error: no input files (Windows)

构建过程中出现错误:

代码*.pro:

QT       += core gui

QT = widgets

TARGET = MYPROJECT
TEMPLATE = app


SOURCES += main.cpp\
           mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

代码mainwindow.h:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>


namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H

作为合规安装:C:\Strawberry\c\bin\g++.exe

程序集是在 Windows 10 64 位中制作的。

及时组装我得到这样的错误:

g++.exe: fatal error: no input files compilation terminated. 09:38:38: The process "C:\Strawberry\c\bin\g++.exe" ended with code 1. Error in assembling / installing the MYPROJECT project (set: MYPROJECT_DESCTOP) During the "Build" stage

我试过在 .pro 文件中包含文件的完整路径,但没有帮助。

确保您的所有代码文件都在当前工作目录中,否则您必须在编译命令中包含它们的路径。