Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Migrating from Builder 6 to Builder 2007

71 views
Skip to first unread message

Bob Lawson

unread,
Oct 19, 2007, 11:59:10 AM10/19/07
to
I have an application that I am trying to move from Builder 6 to Builder
2007. I think my problem is related to AnsiString since it is used through
out the application.

I keep having errors with
using std::string; in cstring
and calls to To_String.

Am I missing a switch on the compiler that will work in compatability mode
to support AnsiString?

Thanks


Remy Lebeau (TeamB)

unread,
Oct 19, 2007, 12:43:46 PM10/19/07
to

"Bob Lawson" <bob.l...@alcoa.com> wrote in message
news:4718...@newsgroups.borland.com...

> I keep having errors with
> using std::string; in cstring
> and calls to To_String.

Please be more specific. What EXACTLY are you having a problem with?


Gambit


Bob Lawson

unread,
Oct 22, 2007, 11:10:23 AM10/22/07
to
I have taken an application that we have developed for years, lastly under
Borland Builder 6 and moved it to a new PC with CodeGear C++ Builder 2007.
I open the project and it converts to a new project file.

Some modules build fine while one generates 51 errors. The thing is the
errors are showing up in system include files.

The first set of errors are:
[BCC32 Error] cstring(29): E2316 'string' is not a member of 'std'
( The line in cstring is: using std::string; )
[BCC32 Error] cstring(29): E2272 Identifier expected
[BCC32 Error] xstring(8): E2041 Incorrect use of default
[BCC32 Error] xstring(8): E2428 Templates must be classes or functions
[BCC32 Error] xstring(8): E2141 Declaration syntax error
[BCC32 Error] xstring(22): E2303 Type name expected
[BCC32 Error] xstring(22): E2275 { expected
[BCC32 Error] xstring(22): E2272 Identifier expected
[BCC32 Error] xstring(23): E2272 Identifier expected
[BCC32 Error] xstring(23): E2275 { expected
[BCC32 Error] xstring(27): E2139 Declaration missing ;
[BCC32 Error] xstring(29): E2139 Declaration missing ;
[BCC32 Error] xstring(214): E2139 Declaration missing ;
[BCC32 Error] xstring(326): E2303 Type name expected

If we take the first one the full parser context is(comments in brackets
below):
Annotation.cpp(3): #include Annotation.h
( There are no other includes or defines before this one.)
Annotation.h(12): #include ..\General\vector_p.h
(There are only system includes before this one.
#ifndef AnnotationH
#define AnnotationH

#include <stddef.h>
#include <Classes.hpp>
#include <Graphics.hpp>
#include <Types.hpp>
#include <Dialogs.hpp>
#include <ExtCtrls.hpp>
#include <Math.hpp>
/* #include "General.h" */
#include "vector_p.h" )
vector_p.h(2): #include c:\program files\codegear\rad
studio\5.0\include\vector.h
( there are no other includes or defines before this one.
#pragma option push -w-pck

#include <vector>
#pragma option pop )
vector.h(18): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\vector
( The rest are all system include files. )
vector(5): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\memory
memory(5): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\xmemory
xmemory(6): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\xutility
xutility(5): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\utility
utility(5): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\iosfwd
iosfwd(6): #include c:\program files\codegear\rad
studio\5.0\include\cstring
cstring(27): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware/string
string(5): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\istream
istream(5): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\ostream
ostream(5): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\ios
ios(5): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\xlocnum
xlocnum(8): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\streambuf
streambuf(5): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\xiosbase
xiosbase(4): #include c:\program files\codegear\rad
studio\5.0\include\dinkumware\xlocale
xlocale(5): #include c:\program files\codegear\rad
studio\5.0\include\cstring
( The error is in this file. )

I'm not sure where to go with this one.

Bob


"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message

Remy Lebeau (TeamB)

unread,
Oct 22, 2007, 12:24:43 PM10/22/07
to

"Bob Lawson" <bob.l...@alcoa.com> wrote in message
news:471cbd67$1...@newsgroups.borland.com...

> I open the project and it converts to a new project file.

That is rarely ever recommended. There is always problems with conversion.
You should always create a fresh project in the new IDE and add your
existing source files to it instead.

> The thing is the errors are showing up in system include files.

Please show the actual code that is failing.

> [BCC32 Error] cstring(29): E2316 'string' is not a member of 'std'
> ( The line in cstring is: using std::string; )

The STL's <string> header (not the RTL's <string.h> header) was likely not
included before reaching that point.


Gambit


Bob Lawson

unread,
Oct 23, 2007, 9:42:56 AM10/23/07
to
Ok... now I'm really confused. Out of despiration I started a new DLL
project.
When I do this it creates me a file1.cpp.

So now a I have a new project, new directory, new file. I build the file
and it builds without error.
The top of the file looks like:

//---------------------------------------------------------------------------

#include <vcl.h>
#include <windows.h>
#pragma hdrstop
//---------------------------------------------------------------------------
// Important note about DLL memory management when your DLL uses the

Now all I do is add the include for strings.

//---------------------------------------------------------------------------

#include <vcl.h>
#include <windows.h>
#include <string>
#pragma hdrstop
//---------------------------------------------------------------------------
// Important note about DLL memory management when your DLL uses the

and now I'm back to my 51 errors!

So this has to rule out anything I have in my old code, old includes etc!
So what is with the #include <string>!

This is a new computer, new installation of the compiler. I should have
tried this simple test two days ago but figured it was in my code.

Any thoughts?

Bob

"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message

Remy Lebeau (TeamB)

unread,
Oct 23, 2007, 12:18:34 PM10/23/07
to

"Bob Lawson" <bob.l...@alcoa.com> wrote in message
news:471dfa62$1...@newsgroups.borland.com...

> Now all I do is add the include for strings.

Don't put it above the #pragma statement. Put it below instead:

#include <vcl.h>
#include <windows.h>
#pragma hdrstop

#include <string>


Gambit


Leo Siefert

unread,
Nov 9, 2007, 8:02:06 AM11/9/07
to
Bob Lawson wrote:

>Now all I do is add the include for strings.

>...


>and now I'm back to my 51 errors!

I just tried doing exactly the same thing and I get a clean build - no
errors or warnings. Doesn't matter if the #include <string> is before
or after the #pragma hdrstop.


It sounds to me like you are somehow calling a header from a different
STL implementation. Check the include path for your project and make
sure that it points to the Builder 2007 include directories before any
other directories and try again.

Another thing you could try is turning off pre-compiled headers to
make sure that the ide is not using a bad pch file.

If that does not work, you can zip up the entire demo project and post
it to the attachments group and post a note here so that we can see if
there is something else going wrong.

- Leo

0 new messages