Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-07-11
5
Medium Priority
?
440 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

705 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