Valhalla Legends Forums Archive | C/C++ Programming | Syntax Error

AuthorMessageTime
shout
I am currently at shcool, in my C++ 1 class. And I made a small program, and in that I have included winbase.h. But when I try to compile, I get 74 syntax errors from winbase.h.

This is all I have (I made a new project to test)
[code]
#include "stdafx.h"
#include <winbase.h>

int main(int argc, char* argv[])
{
return 0;
}
[/code]

Am I just being retarded...?
January 28, 2005, 9:00 PM
Mephisto
What are the files your stdafx.h file includes?  I believe if you were to include windows.h and winbase.h in the same file you'd get a lot of type redefinition errors in the various structs the files contain since windows.h automatically includes winbase.h.

To solve the problem, just put "#include <windows.h>" in stdafx.h and just include stdafx.h.
January 28, 2005, 10:55 PM
Kp
No, you're using broken header files that don't properly include their own dependencies.  You need to track down the dependencies of winbase.h and manually include those (and onward until there are no dependencies), or just give up and include windows.h instead (which will get you a lot of useless material and thereby slow down your compile, but at least it'll work).
January 28, 2005, 10:57 PM

Search