Re: Debug mode won't build. Release does.



Lady_A wrote:
I've written a static lib which does not use MFC or ATL, just STL.
The settings are Multi-Threaded Debug and Multi-Threaded for Debug and Release respectively.
The calling convetion is __cdecl.
It compiles and links in Debug and Release.


To test that lib I've written a basic console exe that has only 2 lines in its main.
It creates an instance of a class from that lib and calls a function on that class.
Nothing else.
It is also set to Multi-Threaded Debug and Multi-Threaded and __cdecl.
It compiles and links in Release.
But it refuses to compile in Debug mode!
Giving out :
"
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\malloc.h(122): error C2059: syntax error : 'constant'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\malloc.h(128): error C2059: syntax error : 'string'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\malloc.h(127): error C2733: second C linkage of overloaded function '_aligned_malloc_dbg' not allowed
"
and etc., according to the funcs in malloc.h file.


It seems like it somehow uses C libraries instead of C++.

I've compared the Debug and Release settings a thousand times.
Did not find anything wrong.

Could someone help please ?


Well, without the ability to sit down at your computer and quickly look things up, I can only tell you to output the results of preprocessing to a separate file and look at the line that gives you the error and at the text immediately preceding it. Compare it to the original code (in the header) and see what macros expanded to what. It is likely that you have some macro interfering with the compilation of Microsoft headers and the interfering macro is defined differently for debug and release modes.

V
.



Relevant Pages

  • Re: release build failed!!!
    ... I did a quick & dirty console project with your enum. ... It compiles fine with ... VC2005 using default debug and release settings. ... All errors are pointing to a single statement, ...
    (microsoft.public.vc.mfc)
  • Re: .net cf sp2 problem
    ... Usually when you tell VS to debug it compiles ... > system is Traditional Chinese. ... > White Rong ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: How to compile simple command prompt apps in VC++ .NET like in VC+
    ... Joachim wrote: ... You will have to create a [console app] project for it. ... If all you need is to test if some code compiles, ... file, compile, build, debug... ...
    (microsoft.public.vc.language)
  • Re: How can I develop in C with VS2005 for Pocket PC??
    ... Ok, I just have substitute in my C code the main function for WinMain, ... Now it compiles with 0 ... when I want to run it or debug it (at the moment I have only some ... yet nothing of Pocket PC) it appears like a pocket pc ...
    (microsoft.public.pocketpc.developer)
  • error with release build
    ... I have a visual studio 2008 asp.net project that compiles fine in debug ... when I switch to release build I get this error: ...
    (microsoft.public.vsnet.general)