Author Topic: Including windows.h - won't compile  (Read 16548 times)

Offline sipickles

  • Multiple posting newcomer
  • *
  • Posts: 19
Including windows.h - won't compile
« on: December 15, 2007, 06:27:34 pm »
Hi,

I am an experienced with MSVC and Code::Blocks on Linux. I'm trying to use C::B as my windows IDE too, but coming unstuck.

My program breaks as soon as I add:

#include <windows.h>

( I was actually trying to include d3dx9.h, but the problem is with windows.h )

Heres my program, I should point out it compiles and runs if I remove the windows.h line:

Code
#include <windows.h>

int main()
{
    return 0;
}

And here are the errors!

Code
-------------- Build: Debug in DX9Test3 ---------------

Compiling: main.cpp
In file included from C:/gamedev/PSDK/Include/windef.h:176,
                 from C:/gamedev/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/excpt.h:20,
                 from C:/gamedev/PSDK/Include/windows.h:157,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/winnt.h:666:2: #error Must define a target architecture.
In file included from C:/gamedev/PSDK/Include/rpc.h:142,
                 from C:/gamedev/PSDK/Include/windows.h:188,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/rpcnterr.h:4:1: warning: "/*" within comment
In file included from C:/gamedev/PSDK/Include/winscard.h:30,
                 from C:/gamedev/PSDK/Include/windows.h:198,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/wtypes.h:17: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/objbase.h:402,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/wtypes.h:17: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/objbase.h:403,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/unknwn.h:17: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/objbase.h:404,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/objidl.h:17: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/objbase.h:404,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/objidl.h:6545: warning: ignoring #pragma warning
C:/gamedev/PSDK/Include/objidl.h:6561: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/objbase.h:978,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/urlmon.h:17: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/msxml.h:274,
                 from C:/gamedev/PSDK/Include/urlmon.h:278,
                 from C:/gamedev/PSDK/Include/objbase.h:978,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/oaidl.h:442:1: pasting "/" and "/" does not give a valid preprocessing token
In file included from C:/gamedev/PSDK/Include/msxml.h:274,
                 from C:/gamedev/PSDK/Include/urlmon.h:278,
                 from C:/gamedev/PSDK/Include/objbase.h:978,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/oaidl.h:442: error: expected unqualified-id before '/' token
C:/gamedev/PSDK/Include/oaidl.h:457:1: pasting "/" and "/" does not give a valid preprocessing token
C:/gamedev/PSDK/Include/oaidl.h:457: error: expected unqualified-id before '/' token
In file included from C:/gamedev/PSDK/Include/objbase.h:978,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/urlmon.h:301: warning: ignoring #pragma comment
In file included from C:/gamedev/PSDK/Include/objbase.h:979,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/propidl.h:17: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/objbase.h:979,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/propidl.h:310:1: pasting "/" and "/" does not give a valid preprocessing token
In file included from C:/gamedev/PSDK/Include/objbase.h:979,
                 from C:/gamedev/PSDK/Include/ole2.h:69,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/propidl.h:310: error: expected unqualified-id before '/' token
C:/gamedev/PSDK/Include/propidl.h:1423: warning: ignoring #pragma warning
C:/gamedev/PSDK/Include/propidl.h:1424: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/oleauto.h:57,
                 from C:/gamedev/PSDK/Include/ole2.h:70,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/oaidl.h:17: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/ole2.h:134,
                 from C:/gamedev/PSDK/Include/windows.h:207,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/oleidl.h:17: warning: ignoring #pragma warning
In file included from C:/gamedev/PSDK/Include/windows.h:214,
                 from E:\_Dev\DX9Test3\main.cpp:4:
C:/gamedev/PSDK/Include/stralign.h: In function `WCHAR* ua_wcscpy(WCHAR*, const WCHAR*)':
C:/gamedev/PSDK/Include/stralign.h:99: warning: ignoring #pragma warning
C:/gamedev/PSDK/Include/stralign.h:100: warning: ignoring #pragma warning
C:/gamedev/PSDK/Include/stralign.h:102: warning: ignoring #pragma warning
Process terminated with status 1 (0 minutes, 2 seconds)
7 errors, 17 warnings
 

I've installed the PSDK, added the global variable, and set the paths for include and lib in search directories.

Am I missing somethng crucial here?

Thanks

Simon
« Last Edit: December 15, 2007, 06:29:19 pm by sipickles »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Including windows.h - won't compile
« Reply #1 on: December 15, 2007, 08:02:20 pm »
Am I missing somethng crucial here?
You are trying to use the MS platform SDK (PSDK) with the GCC compiler. This won't work. GCC (MinGW) ships with it's own Win API implementation. Use that and remove any path to the MS platform SDK from your project (compiler and linker settings!). When it comes to Direct/X: You can use the MS Direct/X SDK with MinGW. GCC just compiles/links fine against the MS Direct/X libs. But again: This is not true for the platform SDK.
Another option w0ould be you select a MS compiler suite for Windows. That way you could use the platform SDK. Nearly all MS compilers (including e.g. the free Visual C++ toolkit) are supported within C::B.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline sipickles

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: Including windows.h - won't compile
« Reply #2 on: December 15, 2007, 08:39:30 pm »
Thanks, thats a great help.