Debug Build fails, Release Build OK - VC++ 6.0 to VS2005 port

G

Guest

I'm trying to upgrade a large project from VS 6.0 to VS 2005.
After fixing a lot of things that changed (mostly sloppy coding in the
original project that VS2005 didn't allow), I got the release version to
build successfully. Unfortunately, it crashes right away when I start it.
So now I need to build the debug version. Unfortunately, the compiler gives
innumerable error messages of the sort shown below.

The #include file referenced here is included by way of <fstream> and its
subsidiary files. The original project used <fstream.h> which no longer
exists. Apparently the code syntax of my fixes satisfies the compiler, since
the release version builds successfully. So maybe there is a switch I need
to throw? But I can't find it. Searching MSDN, these newsgroups, etc.,
didn't turn up anything, but I'll be this is something that has been
discussed in the past.

Thanks in advance.

--
C Gregory
Tecmag, Inc.

Compiling...
AcqPropsDialog.cpp
d:\program files\microsoft visual studio 8\vc\include\xdebug(32) : warning
C4229: anachronism used : modifiers on data are ignored
d:\program files\microsoft visual studio 8\vc\include\xdebug(32) : error
C2365: 'operator new' : redefinition; previous definition was 'function'
d:\program files\microsoft visual studio 8\vc\include\xdebug(32) : error
C2491: 'new' : definition of dllimport data not allowed
d:\program files\microsoft visual studio 8\vc\include\xdebug(32) : error
C2078: too many initializers
d:\program files\microsoft visual studio 8\vc\include\xdebug(32) : error
C2440: 'initializing' : cannot convert from 'int' to 'void *'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast
d:\program files\microsoft visual studio 8\vc\include\xdebug(32) : error
C2143: syntax error : missing ';' before '('
d:\program files\microsoft visual studio 8\vc\include\xdebug(32) : error
C2226: syntax error : unexpected type 'size_t'
d:\program files\microsoft visual studio 8\vc\include\xdebug(33) : error
C2059: syntax error : ')'
d:\program files\microsoft visual studio 8\vc\include\xdebug(36) : warning
C4229: anachronism used : modifiers on data are ignored
.....etc.....
 
C

Christopher Pisz

You need to get rid of every single deprecated header that has been replaced
by the new (not so new) std library.
There is a list on MSDN if you search for iostream libraries or
"msvcirtd.lib" I think... I can check on monday at work.

Things like
fstream.h
iostream.h
ios.h
string.h

etc. all need to be the on .h includes
such as
fstream
iostream
etc..

Then of course you must specify std:: or make use of using statements

As such, you must also check that every include that is included by and
included file also does not contain those.. fun!
Also, every lib and .dll linked with must also use the new includes and have
the flag below the same.

And of course the implementation may need to be changed to reflect the c++
standard

Also make sure you do not have /MDd set but instead of /MTd set in the
project settings. I think it is one of the linker settings.
It controls which iostream library you link with for debug
the old one was msvcirtd.lib, I believe, which no longer exists in at least
my vc8 install.

It's a place to start anyway.

It appears to me that something is causing the older library and the new
library to both be linked and it is not liking that. That's my theory.
 
G

Guest

Christopher
Thanks for the suggestions. I thought I had fixed the deprecated calls,
etc.-- but i'll check again.

The thing that troubles me is that it doesn't seem to be a linker problem -
the error is during compilation - some flag is being set by the fstream
header that is resented by subsequent headers....and only if it is a debug
build!


C Gregory
Tecmag, Inc.
 
G

Guest

Can you also check what is the Warning Level set for the debug mode.
Typically any new project will have /W4

And Also move fstream on top of the include sequence
 
G

Guest

Vikas

Thanks! I moved <fstream> up just after "stdafx.h", and now it works. The
warning level was /W3, but /W4 did not provide any (helpful) extra info.

Carl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top