This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Howto get basic STL running
- From: Øyvind Harboe <oyvind dot harboe at zylin dot com>
- To: ecos-discuss at sources dot redhat dot com
- Date: Fri, 16 Jan 2004 16:17:23 +0100
- Subject: [ECOS] Howto get basic STL running
- Organization: Zylin AS
I get the impression that there are people out there that use STL
w/eCos. There are numerous posts that hint as much in ecos-discuss, but
I didn't find any "howto".
Specifically I'm interested in "class string".
This is how far I got:
--- test app ---
#include <stdio.h>
void remove();
void rename();
void tmpfile();
void tmpnam();
#include <memory>
#include <string>
void test()
{
std::string xx="abc";
// string yy=xx+"kljasdf";
}
--- test app ---
Once I twisted the arm of GCC to compile the thing, I got these linking
errors:
---- linking errors ----
output/./xxx.o: In function `test()':
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::allocator<char>::allocator[in-charge]()'
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::basic_string[in-charge](char const*, std::allocator<char> const&)'
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::allocator<char>::~allocator [in-charge]()'
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::allocator<char>::~allocator [in-charge]()'
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::~basic_string [in-charge]()'
collect2: ld returned 1 exit status
make: *** [output/rimi.bin] Error 1
---- linking errors ----
After a bit of googling, I discovered that I was missing various things
in libstdc++ that explicitly instantiates templates, e.g.:
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/gcc/gcc/libstdc++-v3/src/allocator-inst.cc?rev=HEAD&content-type=text/plain
Although I could make some linker errors disappear as I pasted in bits
of code from the savannah CVS, I was always left with a couple of more
linker errors...
Ãyvind
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss