Solved

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

Posted on 2006-07-11
5
432 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
TTimer no longer functioning 7 90
Visual c++ and text files 7 67
Move constructor only called if marked noexcept? 6 104
FMX StringGrid1->Canvas->FillRect Problem 3 151
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

770 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