Windows.h doing something strange

I have a code (a long one, so I won't include it) which works fine, and then I want to include Windows.h (by writing #include "Windows.h" at the beginning) to use the function Sleep().

But when I do this I get a bunch of error messages, most of them are: expected unqualified-id before ‘char’

They appear at different seemingly random places in the code (and actually it seems the compiler gets the places a bit wrong; there is never a char declaration right where the error occurs but always close to it).

I've used Sleep() before with no problems. Any ideas?

EDIT: spelling
Last edited on
It's hard to say without seeing the code. Does it work to compile a single file with only #include "Windows.h" in it?
Yeah sorry about not posting any code but honestly it's a big mess. Anyway, all I can say is that it all works without the #include "Windows.h" and Sleep(), and that I wrote another small functioning program including the two (in answer to your question).

I tried including some char's in the mentioned functioning program that uses Sleep() and it still works.
Is it when you add #include "Windows.h" or the call to Sleep() that it stop working?

Take away parts of your program until you find what is wrong. If you don't find it you hopefully have reached a very small program that is small enough to post here.
Maybe
#define WIN32_LEAN_AND_MEAN
before
#include "windows.h"
helps.
Simply including "Windows.h" will give the error.

Thanks for the advice! I started doing what you say to end up with a postable code but it's just too big a task; it's much easier to find something else than Sleep (which I was only using to find another error anyway).
Can you post some of these errors? Do you include any other Windows header files?
The #define WIN32_LEAN_AND_MEAN actually worked! I half thought it was a joke since it sounded so strange. Thanks!
It's not the first time, that happens to me.
Topic archived. No new replies allowed.