tags:

views:

40

answers:

2

I've got some example code for controlling a wifi module that tells me to use VC 6.0, and that newer versions aren't supported. I'm trying to get it work, anyway. It uses CString, which is part of MFC, so I've downloaded a trial of Visual Studio 2010 to see if I can get it to compile. Here's the code that's throwing the (start of the) errors:

#ifdef _UNICODE  
//Use CString as the standard string type in UNICODE versions
typedef CString WuString; // Line 42
#endif

And here's the error messages:

1>d:\...\my documents\authapiex\apps8.0.0.90_sdk_xp\include\wtypes.h(42): error C2146: syntax error : missing ';' before identifier 'WuString'
1>d:\...\my documents\authapiex\apps8.0.0.90_sdk_xp\include\wtypes.h(42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\...\my documents\authapiex\apps8.0.0.90_sdk_xp\include\wtypes.h(42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Any help would be great.

A: 

You are missing the include for CString.

#include <afx.h>
Nikola Smiljanić
I actually have <afx.h> included in stdafx.h, which is included first, before the headerfile which includes the header file that throws the error. So as far as I can tell, the compiler is compiling header files out of order?
Colin DeClue
A: 

It looks like CString is not defined at the point where you put in the typedef. You'll need to make sure to include the appropriate include file before your typedef.

Timo Geusch
I actually have <afx.h> included in stdafx.h, which is included first, before the headerfile which includes the header file that throws the error. So as far as I can tell, the compiler is compiling header files out of order?
Colin DeClue
It's fairly hard to work out from your code snippet, can you come up with a minimal piece of code that shows the problem?
Timo Geusch