Thread View: borland.public.cppbuilder.migration
5 messages
5 total messages
Started by johnp
Fri, 05 Aug 2005 13:15
Tied up with string
Author: johnp
Date: Fri, 05 Aug 2005 13:15
Date: Fri, 05 Aug 2005 13:15
58 lines
2789 bytes
2789 bytes
Hi I'm porting code from BCB3 to BCB6, which uses STL string and stream classes. No matter what the include file, I get either "undefined symbol 'string' " & "undefined symbol 'ifstream' " or (if I include oldstl/string.stl) "multiple definitions errors" The BCB6 headers are below. The // comments are mine Should I be using the old Roguewave STl or SPLport ? How do I get the correct header to load ? what is macro def "__cplusplus" all about #if !defined(__cplusplus) # include <_str.h> //'C' string functions, no string class defs # else /* __cplusplus */ # include <_str.h> # if defined(__USING_STD_NAMES__) # ifdef _USE_OLD_RW_STL # include <oldstl/string.stl> // stub redirector for _str.h or oldstl/string.stl # else # include <stlport/string> //see below # endif # endif /* __USING_STD_NAMES__ */ #endif contents of stlport/string # ifndef _STLP_STRING # define _STLP_STRING # ifndef _STLP_OUTERMOST_HEADER_ID # define _STLP_OUTERMOST_HEADER_ID 0x68 # include <stl/_prolog.h> //contains no class definitions # endif #if defined (_STLP_USE_NATIVE_STRING) . # if defined (_STLP_MSVC) # include <streambuf> # include <istream> # endif # include _STLP_NATIVE_HEADER(string) # endif /* _STLP_USE_NATIVE_STRING */ # if !defined (_STLP_USE_NATIVE_STRING) || defined (_STLP_USE_OWN_NAMESPACE) # include <stl/_string.h> //Standard C++ string class. Including this file gives "undefined symbol 'string'" # else # include <stl/_string_hash.h> //no class definitions # endif /*_STLP_USE_NATIVE_STRING */ // cleanup # if (_STLP_OUTERMOST_HEADER_ID == 0x68) # include <stl/_epilog.h> # undef _STLP_OUTERMOST_HEADER_ID # endif #endif /* _STLP_STRING */
Re: Tied up with string
Author: Remy Lebeau (TeamB)
Date: Fri, 05 Aug 2005 17:41
Date: Fri, 05 Aug 2005 17:41
15 lines
1189 bytes
1189 bytes
"johnp" <john.pearson@NOSPAM.co.uk> wrote in message
news:42f36665@newsgroups.borland.com...
> No matter what the include file, I get either
> "undefined symbol 'string' " & "undefined symbol 'ifstream' "
What does your code actually look like? The only includes you need are the
following:
#include <string>
#include <fstream>
Gambit
Re: Tied up with string
Author: Ed Mulroy
Date: Fri, 05 Aug 2005 22:11
Date: Fri, 05 Aug 2005 22:11
70 lines
3297 bytes
3297 bytes
BCB 3 is from way back before the C++ Language specification was revised. BCB 5 is newer. Did you forget the 'std::' as in std::string s = "abc"; . Ed > johnp wrote in message > news:42f36665@newsgroups.borland.com... > Hi > > I'm porting code from BCB3 to BCB6, which uses STL string and stream > classes. > No matter what the include file, I get either "undefined symbol 'string' " > & "undefined symbol 'ifstream' " > or (if I include oldstl/string.stl) "multiple definitions errors" > The BCB6 headers are below. The // comments are mine > > Should I be using the old Roguewave STl or SPLport ? > How do I get the correct header to load ? > what is macro def "__cplusplus" all about > > #if !defined(__cplusplus) > # include <_str.h> //'C' > string functions, no string class defs > # else /* __cplusplus */ > # include <_str.h> > # if defined(__USING_STD_NAMES__) > # ifdef _USE_OLD_RW_STL > # include <oldstl/string.stl> // stub > redirector for _str.h or oldstl/string.stl > # else > # include <stlport/string> //see > below > # endif > # endif /* __USING_STD_NAMES__ */ > #endif > > contents of stlport/string > > # ifndef _STLP_STRING > # define _STLP_STRING > # ifndef _STLP_OUTERMOST_HEADER_ID > # define _STLP_OUTERMOST_HEADER_ID 0x68 > # include <stl/_prolog.h> //contains > no class definitions > # endif > #if defined (_STLP_USE_NATIVE_STRING) . > # if defined (_STLP_MSVC) > # include <streambuf> > # include <istream> > # endif > # include _STLP_NATIVE_HEADER(string) > # endif /* _STLP_USE_NATIVE_STRING */ > # if !defined (_STLP_USE_NATIVE_STRING) || defined > (_STLP_USE_OWN_NAMESPACE) > # include <stl/_string.h> //Standard C++ string class. Including this file > gives "undefined symbol 'string'" > # else > # include <stl/_string_hash.h> //no class > definitions > # endif /*_STLP_USE_NATIVE_STRING */ > // cleanup > # if (_STLP_OUTERMOST_HEADER_ID == 0x68) > # include <stl/_epilog.h> > # undef _STLP_OUTERMOST_HEADER_ID > # endif > #endif /* _STLP_STRING */
Re: Tied up with string
Author: johnp
Date: Fri, 05 Aug 2005 22:33
Date: Fri, 05 Aug 2005 22:33
8 lines
1231 bytes
1231 bytes
> BCB 3 is from way back before the C++ Language specification was revised. >BCB 5 is newer. > Did you forget the 'std::' as in > std::string s = "abc"; > . Ed Ed - You are correct - thanks very much for that ! Oh yes, what is __cplusplus ?
Re: Tied up with string
Author: Remy Lebeau (TeamB)
Date: Fri, 05 Aug 2005 23:46
Date: Fri, 05 Aug 2005 23:46
12 lines
1272 bytes
1272 bytes
"johnp" <john.pearson@NOSPAM.co.uk> wrote in message news:42f3e92d@newsgroups.borland.com... > Oh yes, what is __cplusplus ? A precompiler define that indicates whether the current file is being compiled as a C++ file. If not defined, the file is being compiled as a C file instead. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads