Reputation: 95
I just installed Qt on my Windows 10 PC. I create a new project, and write some lines in the mainwindow.cpp file:
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow){
ui->setupUi(this);
}
MainWindow::~MainWindow() {
delete ui;
}
But the Qt environment gives me errors on some lines:
mainwindow.cpp: 2: 10: error: 'ui_mainwindow.h' file not found
mainwindow.cpp: 4:24: error: unknown type name 'QWidget'
mainwindow.cpp: 6: 12: error: allocation of incomplete type 'Ui :: MainWindow'
mainwindow.h: 7: 7: note: forward declaration of 'Ui :: MainWindow'
mainwindow.cpp: 8: 7: error: member access into incomplete type 'Ui :: MainWindow'
mainwindow.h: 7: 7: note: forward declaration of 'Ui :: MainWindow'
When compiling:
Cannot run complier 'clang ++'
How do I fix these problems? How and where to install clang++?
Upvotes: 6
Views: 17630
Reputation: 38
You need to change your build directory. Settings -> under "Deskstop Qt...." build ->
then if you have wrong build directory (if it was wrong it would be red). You need to change it.
The new build directory must be the folder where you save your Qt project when you just created it.
Upvotes: 1