Solved

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

Posted on 2006-07-11
5
434 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

735 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