krzakov
krzakov

Reputation: 4111

Compilation QT Creator project using classic terminal and gcc/g++

I'm tired searching in internet. I created a klient-serwer program, which shut down computer just by their IP's on specific port.I made whole thing in C, everything works perfectly, i'm compiling my project using gcc with -Wall option and I've got a clear results. But I had to create GUI so i decided to use QT Creator IDE, I transfered code from C into C++ and i made GUI. Program works but I have to compile this using g++ with -Wall option. Thing is, I cannot compile anything.

g++ my_project.cpp -o mypro -Wall

ERROR: fatal error: QMainWindow: directory don't exist (in my native language)
compilation terminated
(same with other source files)

Any ideas? It's propably very easy, but believe me, I want to compile this and go to sleep. Cheers

Upvotes: 0

Views: 1228

Answers (2)

Sergey
Sergey

Reputation: 8238

Why don't you use qmake? First, you can edit your *.pro file and add any compiler flags you wish (see Mitch's comment). Then, if you execute qmake and then make, it will show you a sequence of compilation commands with proper flags, linker and include paths and so on. After that you can just reproduce that commands manually if your teacher wants so.

Upvotes: 1

The error shows that the compiler is trying to open QMainWindow as if it was a directory (if the translation is correct) or at least failing to locate where the include files for Qt are. You probably need to provide some -I option to hint the compiler as to where the Qt headers are, and make sure that the #include directives are correct in your code.

Upvotes: 0

Related Questions