Error : can't run my program
-
Hello everyone, I'm new, and I'm trying to use qt for a Linux application.
I'm on Linux mint and the version of qt I'm using is 5.12.8.
I created an empty project to start with. My pro file contains the following configuration:
SOURCES += \ main.cpp QT += core QT += widgetsand my main.cpp contains the following code:
#include <QApplicationStateChangeEvent> int main(int argc, char *argv[]) { QApplication app(argc,argv); return app.exec(); }The problem is that qt tells me on line 4:
variable has incomplete type Qapplication.Can you help me solve this problem, thank you in advance.
-
Hi and welcome to devnet,
You are missing
#include <QApplication>in your main.cpp file.
-
@SGaist said in Error : can't run my program:
Hi and welcome to devnet,
You are missing
#include <QApplication>in your main.cpp file.
Hello again.
I had inclued <QApplication> but i have the same error :(
-
Hi, also please check, on line 4, that you have written
QApplication
and not
Qapplication@hskoglund Typing mistake... But even with QApplication I have the same mistake.
-
@hskoglund Typing mistake... But even with QApplication I have the same mistake.
@CyberSnake Instead of looking for a needle in a haystack, are you able to build and run any Qt example?
-
@hskoglund Typing mistake... But even with QApplication I have the same mistake.
@CyberSnake
You are claiming that if you copy & paste the following code:#include <QApplication> int main(int argc, char *argv[]) { QApplication app(argc,argv); return app.exec(); }you will get one error message of
variable has incomplete type QApplication.Is that right? If you copy & paste the above? With no other error about not being able to find the header file? Is this a compile-time error, or a message from Qt Creator when you just look at the code?