Link to home
Start Free TrialLog in
Avatar of stereophonic
stereophonic

asked on

error C2059 syntax errors, compiles in relase mode but not in debug mode

Hi,

I am getting a bunch of these errors in my python extension module code pointing to  header files.  Please note that I am  getting
these errors only in debug mode. I don't get any errors in release mode. I am using visual studio .net 2003 to build my application

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdlib(17): error C2059: syntax error : ':'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdlib(19): error C2143: syntax error : missing '{' before ':'

How to get rid of these errors?

Thanks
Avatar of Axter
Axter
Flag of United States of America image

Hi stereophonic,
> How to get rid of these errors?
Please post the code you're getting these errors with.

David Maisonave (Axter)
Cheers!
stereophonic,
> c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdlib
If you're cstdlib matches mine, then more then likely you're getting these errors because you're mixing standard headers with non-standard headers, or because you're missing a required STD header.

David Maisonave (Axter)
ASKER CERTIFIED SOLUTION
Avatar of itsmeandnobodyelse
itsmeandnobodyelse
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of e_tadeu
e_tadeu

Probably, you are including cstdlib (or another header that includes it) inside something like this:

#ifdef _DEBUG
// ....
#endif

This is the reason you get the error only in debug mode.

Also: Are you including <cstdio> from a .C file? In this case, you must include <stdio.h> and NOT <cstdio>. OR: rename your file to .cpp.
Avatar of stereophonic

ASKER

Thank you all for the great help

Errors in my code I guess was due to mixing up the standard headers with nonstandard headers.
I used all the suggestions made and finally got it compiled.

Thanks again