Home » Language IDEs » C / C++ IDE (CDT) » Error with QT under eclipse and windows 7
|Error with QT under eclipse and windows 7 [message #957992]
||Thu, 25 October 2012 17:09
| Omar Mustafa
Registered: October 2012
I have tried now about 8 hours to get running qt on eclipse. Also I have installed MinGW, QT Integration and CDT for C++ programming under eclipse.
I get following error messages on my console if I try to compile an empty project:
19:00:08 **** Build of project test ****
mingw32-make.exe -f Makefile.Debug
mingw32-make.exe: Entering directory `D:/Entwicklung/SmartBlue/test'
g++ -c -g -Wall -Wextra -fno-exceptions -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -DQT_NO_DYNAMIC_CAST -I"c:\Qt\4.8.3\include\QtCore" -I"c:\Qt\4.8.3\include\QtGui" -I"c:\Qt\4.8.3\include\Qt3Support" -I"c:\Qt\4.8.3\include" -I"c:\Qt\4.8.3\include\ActiveQt" -I"debug" -I"c:\Qt\4.8.3\mkspecs\default" -o debug\main.o main.cpp
In file included from c:\Qt\4.8.3\include/QtCore/qglobal.h:1:0,
mingw32-make.exe: Leaving directory `D:/Entwicklung/SmartBlue/test'
c:\Qt\4.8.3\include/QtCore/../../src/corelib/global/qglobal.h:45:20: fatal error: stddef.h: No such file or directory
mingw32-make.exe: *** [debug/main.o] Error 1
mingw32-make.exe: *** [debug] Error 2
can please somebody helps me. I'm with the end with my nerves.
thanks a lot to all.
|Re: Error with QT under eclipse and windows 7 [message #962788 is a reply to message #958001]
||Mon, 29 October 2012 10:28
|| Anthony Turner
Registered: October 2012
Location: New York
Hey Omar, |
Your problem sounds like it has to do with forgetting to include the QtCore for your compiler's path.
I have just spent the past couple of days pulling my hair out with trying to integrate QT with eclipse. I even attempted GDK+, GTKmm and wxWidget.
Finally, last night, I have QT working with eclipse. The only problem is when ever I run project with QT code that uses a Q_OBJECT( this is for Signals and Slots ), I get a compile error about v_table. I looked it up and it has something to do with QMake and mocing up ( moc.exe I believe ).
Anyhow, for your problem, go to your Project, select Properties, then C/C++ Build, and Settings.
Underneath the first tab ( Tool Settings ), select the compiler you are using. For example, If you are creating a C++ project, then select GCC C++ compiler. If a C Project, then select GCC C Compiler.
Select Includes . You will notice at the top it says "Include Paths (-I)", this is key because if you was to compile and run your project with another compiler ( such as QT Creator, or in cmd with MinGW32-make ), you would notice in console or compiler verbose output that there are directories which have this -I before them. For Example, -IC:\QT\include\QtCore
These are the paths needed for eclipse.
In your case, you need to click on the green plus icon and add the path to where the QtCore file is located.
So, what you can do, in command console, compile your program with mingw32-make:
Go to your project directory in command prompt ( assuming windows ).
compile your project once by doing each of these lines pushing enter after each line...
This is assuming your environment variables are setup to know where qmake and mingw32-make are.
After the last command ( mingw32-make ), take note of what flags and paths are used when your project is compiled.
Like I mentioned, anything with -I in front of it gets added to your projects GCC Compiler Include.
There will be one line with -L and then a directory; this is your Library path.
This path gets added to MinGW C++ Linker, Libraries, Libraries Search Path, which is also with in the same section as the GCC C++ compiler.
There will be flags with -l ( lower case L ), each one that comes after the -l goes in MinGW C++ Linker, Libraries, Libraries (-l). Just the name of the library with out the -l.
In MinGW C++ Linker, Miscellaneous, there is a section named Linker Flags. Here, you can add the linker flags. I forget which one they were exactly from console, but they are around or before the -L and where the Linker options begin. It should say something like g++ -mthreads -Wl,-subsystem,windows
There are a bunch of flags for the G++ C++ compiler as well. Many start with -D
The base ones are something like -c -fmessage-length=0 -Wextra -fno-exceptions -fno-rtti These can be set in the Miscellaneous section of the GCC C++ Compiler.
Have you set up an external Builder?
If not, Go to C/C++ Build
Under Current builder choose GNU Make Builder then click apply.
Then go to C/C++ Build
Builder type should be External Builder
Build command: mingw32-make
It has taken me a lot of time to figure this out, so I'm happy to share it.
All works well with eclipse except the Q_OBJECT. Because of this, I created a small batch file to compile my program. I use this in eclipse through the external configuration launcher.
The autoexec.bat runs the commands i mentioned above:
I hope my info is organized and easy to follow.
Best wishes and happy coding.
Current Time: Tue Oct 25 12:29:26 GMT 2016
Powered by FUDForum
. Page generated in 0.02654 seconds