PDA

View Full Version : Problem with include of windows.h



QtNoob
26th May 2009, 21:27
Hello,
i want use windows.h in my project. But i get an error when i include windows.h.
I'm working with Qt4.5 and the latest MinGW version (5.1.4)

In file included from C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/objbase.h:71,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/ole2.h:9,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windows.h:114,
from main.cpp:61:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/wtypes.h:159: error: expected unqualified-id before numeric constant
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/wtypes.h:159: error: expected `)' before numeric constant
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/wtypes.h:160: error: expected unqualified-id before numeric constant

...
...
...

C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/oleauto.h:618: error: expected primary-expression before "const"
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/oleauto.h:618: error: expected primary-expression before ')' token
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/oleauto.h:618: error: initializer expression list treated as compound expression

Maybe someone can help me to fix my problem?!
Greets QtNoob

aekilic
26th May 2009, 21:34
There shouldn't be any problem how do you include it?

QtNoob
26th May 2009, 21:59
hi, i include it so

#inlcude <windows.h>

i checked out that the error occurs only when i add the windows.h include after other includes or in other cpp files like this for example...



#include "defines.h"
#include <windows.h>

int main(int argc, char *argv[])
{
....

i cannot understand why it is not working.

I tested it with a C++ projekt (not Qt) and there is no problem...

aekilic
26th May 2009, 22:07
I dont see a problem but try to use it in a different application on QT

QtNoob
26th May 2009, 22:33
with another qt project i got no errors.

now i will generate automatically the .pro of the project , maybe there could be an error

QtNoob
26th May 2009, 22:50
The auto generated .pro doesn't help.
After that i moved the include before the header include of my .cpp file. now it works.
... strange ....

#include <windows.h>
#include "MyClass.h"

Thank you for your hints and your help !

Greets QtNoob