I have a QT Application, but as I undestand, the ui file is not found. All of the listed files are located in the same directory, the projects root folder. I'm using Clion as IDE and have created the ui with Clion. My CMakeLists.txt:
cmake_minimum_required(VERSION 3.9)
project(Restclient)
find_package(cpprestsdk REQUIRED)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt6 COMPONENTS
Core
Gui
Widgets
REQUIRED)
add_executable(Restclient main.cpp rest/Client.cpp rest/Client.h rest/User.cpp rest/User.h rest/Message.cpp rest/Message.h rest/LoginException.h login.cpp login.h login.ui)
target_link_libraries(Restclient
Qt::Core
Qt::Gui
Qt::Widgets
cpprestsdk::cpprest
)
The Login.ui is located in the projects root folder, the corresponding Login.h :
//
// Created by simon on 28.04.22.
//
#ifndef RESTCLIENT_LOGIN_H
#define RESTCLIENT_LOGIN_H
#include <QWidget>
#include <QPushButton>
#include <QLineEdit>
QT_BEGIN_NAMESPACE
namespace Ui { class Login; }
QT_END_NAMESPACE
class Login : public QWidget {
Q_OBJECT
QPushButton * loginButton;
QLineEdit * passwordInput;
QLineEdit * usernameInput;
public slots:
void buttonPressed();
public:
explicit Login(QWidget *parent = nullptr);
~Login() override;
private:
Ui::Login *ui;
};
#endif //RESTCLIENT_LOGIN_H
And login.cpp
#include "login.h"
Login::Login(QWidget *parent) :
QWidget(parent), ui(new Ui::Login) {
ui->setupUi(this);
QObject::connect(loginButton, &QPushButton::clicked, this, &buttonPressed);
}
Login::~Login() {
delete ui;
}
void Login::buttonPressed() {
//todo process login
}
My error is: invalid use of incomplete type 'class Ui::Login' and no 'forward declaration of 'class Ui::Login'. I'm a java dev who is new to cpp, so some help would be nice.