Including windows.h in my VC++ project

Everytime I try to include <windows.h> into my project some kind of errors occur. First when I included it before "using namespace System;" is game me errors because of function/variable name clashes, but when I included the file after I used the System namespace it give me errors like "cannot use this indirection on type '.......::IDataObject'" and so on with variaous other things just like this but with other aspects of my project. So could you guys help me include the libray

Just to be clear: I made the GUI part of my project using the GUI editor provided with VS 2010, and I am trying to use scintilla (the syntax highliter) in my project, but I cant seem to get <windows.h> to include correctly
Last edited on
I figured it out. All i needed to do was include it AFTER i included stdafix.h
:-)

When the compiler is told to use a pre-compiled header, it assumes it's already compiled up to the stdafx.h line (or whatever name it's been told to use for the header) when it compiles a .cpp file. So the first line it looks at is the one after the stdafx.h line.

Note that you usually add windows.h to stdafx.h. The whole point of the pch mechanism is to avoid re-compiling large, unchanging headers. Which include the Windows headers.
Last edited on
Topic archived. No new replies allowed.