If you trying to compile source code, having some STL used, with CC in SunOS. You may fail.
For example:
If you use std::list::sort() in, you will get following error like this one:
Error: Could not find a match for std::list::sort(bool(int,int))
This happens because CC is using the old libCstd .
Here’s a simple hello world program (everyone could write one)
#include <iostream> using namespace std; int main() { cout << "hello world" << endl; return 0; } |
So compile it with g++, see what happened.
$ g++ hello.cpp $ ./a.out hello world $ ldd a.out libstdc++.so.6 => /packages/gcc/4/lib/libstdc++.so.6 libm.so.2 => /lib/libm.so.2 libgcc_s.so.1 => /packages/gcc/4/lib/libgcc_s.so.1 libc.so.1 => /lib/libc.so.1 /platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1
Definitely, it uses libstdc++.
Now try CC this time.
$ ldd a.out libCstd.so.1 => /usr/lib/libCstd.so.1 libCrun.so.1 => /usr/lib/libCrun.so.1 libm.so.2 => /lib/libm.so.2 libc.so.1 => /lib/libc.so.1 /usr/lib/cpu/sparcv8plus/libCstd_isa.so.1 /platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1
See that? It use libCstd, which has something missing!
Detail:
http://developers.sun.com/sunstudio/documentation/ss12u1/mr/READMEs/c++_faq.html#LibComp3
Solution for this is to use another library rather than libCstd. You can use stlport4.
For example:
CC source.cpp -c -library=stlport4