SOs and Templates

I am trying to do something very simple, yet I can't get the Sun Forte 6 C++ compiler to do it. I know it is probably my fault, but I don't know...

I am compiling a file containing:

<pre>

#include <string>

std::string Foo(void) { return std::string("Foo"); };

</pre>

With the command:

<pre>

/export/home/Forte6/SUNWspro/bin/CC \

-G \

-KPIC \

-zdefs \

-mt \

-g \

-instances=extern \

-library=libC,Cstd,Crun \

-lc \

-ldl \

-lCstd \

-o test.so \

-h test.so \

test.cpp

</pre>

And the result is:

<pre>

Undefinedfirst referenced

symbolin file

std::basic_string<char,std::char_traits><char>,std::allocator<ch ar> >::basic_string(const char*,const std::allocator<char&>)test.o

ld: fatal: Symbol referencing errors. No output written to test.so

</pre>

Please let me know if you can think of anythin that I could try!

Thanks,

Mike

mmcintosh@acm.org

[1127 byte] By [mgmcintosh] at [2007-11-25 23:41:57]
# 1

CC ignores the -library=libC,Cstd,Crun when

compiled with -G. -G makes a shared library

Yes, I have complained before.

Either take away the -z defs (which insist that

all symbols shall be resolved), and let the

linking of the application take care of finding

those libraries, or add the right -L and -l options

yourselfes. The first is easiest.

Welcome, Thorbj鴕n willoch@slb.com

willoch at 2007-7-5 18:49:28 > top of Java-index,Development Tools,Solaris and Linux Development Tools...