Solved

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

Posted on 2006-07-11
5
433 Views
Last Modified: 2011-09-20
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
0
Comment
Question by:stereophonic
5 Comments
 
LVL 30

Expert Comment

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

David Maisonave (Axter)
Cheers!
0
 
LVL 30

Expert Comment

by:Axter
ID: 17083095
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)
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 500 total points
ID: 17083592
Please post  'c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdlib'

cstdlib is a header file you normally don't need to include. It is provided cause of compatibilty reasons to avoid preprocessor mix of old and new standard header files. <cstdlib> includes old <stdlib.h> but defines or undefines some macros to make stdlib.h compliant to the current STL headers.

if you include <cstdlib> yourself, I recommend to remove that include statement and try to compile without.

Regards, Alex


0
 
LVL 4

Expert Comment

by:e_tadeu
ID: 17084808
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.
0
 

Author Comment

by:stereophonic
ID: 17092247
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


0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question