Board index » cppbuilder » Rouge Wave Std Lib

Rouge Wave Std Lib

Hi there,

if I include <string> ( which comes with Rouge Waves Std Lib ) in two
different .cpp files, which belong
to one project, the linker warns:

Linker: public symbol 'std::operator>>(istream&, std::basic_string<char,
std::string ... defined in both module moduleA.obj and moduleB.obj

Ive found that Rouge Wave includes *source* code for both, operator >>
and aoperator << for string<T> class in its header file...

Because string<T> is implemented as a template class, the compiler
creates  code for each new class I declare with the template. So, if I
include the  same string-template e.g. string<int> in two modules, the
code for string<int> is included twice, and the linker warns....

Has anybody a solution for that problem ?

Help is welcome.

Tilo

 

Re:Rouge Wave Std Lib


Quote
Tilo Arnold <100413.3...@compuserve.com> wrote in message

<34FCF5BD.6...@compuserve.com>...

Quote
>Hi there,

>if I include <string> ( which comes with Rouge Waves Std Lib ) in two
>different .cpp files, which belong
>to one project, the linker warns:

>Linker: public symbol 'std::operator>>(istream&, std::basic_string<char,
>std::string ... defined in both module moduleA.obj and moduleB.obj

>Ive found that Rouge Wave includes *source* code for both, operator >>
>and aoperator << for string<T> class in its header file...

>Because string<T> is implemented as a template class, the compiler
>creates  code for each new class I declare with the template. So, if I
>include the  same string-template e.g. string<int> in two modules, the
>code for string<int> is included twice, and the linker warns....

>Has anybody a solution for that problem ?

Define a new type with the template and use this everywhere you need it, the
code will only be generated ones.

For example:

typedef string<int> IntString;

Then use:

IntString myfirststring;
...
IntString mysecondstring;

Quote

>Help is welcome.

>Tilo

Greetings from Kris,
e-mail : we1...@planetinternet.be

Other Threads