Altera_Forum
Honored Contributor
20 years agoC++ Standard Libraries
Hi!
I have started working with C++ in my project. Creating classes and using own objects is no problem, Now I want to use objects of the standard library, e.g. class "string", but I get lots of linker errors. My linker flags are: ECOS_GLOBAL_LDFLAGS = -g -nostdlib -Wl,--gc-sections -Wl,-static -mno-hw-mul -mno-hw-div Example of my source code: # include <string> using namespace std; .... void ThrdMain(cyg_addrword_t data) { ... string s1 = "Hello"; string s2 = " "; s2 = s1; ... } This causes many unresolved methods of the class "string": background.o(.text.ThrdBackground+0x3c):/cygdrive/f/alt_projects/R106/application/src/background.cpp:104: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)' background.o(.text.ThrdBackground+0x44):/cygdrive/f/alt_projects/R106/application/src/background.cpp:104: undefined reference to `std::allocator<char>::~allocator()' background.o(.text.ThrdBackground+0x4c):/cygdrive/f/alt_projects/R106/application/src/background.cpp:42: undefined reference to `std::allocator<char>::allocator()' ... and many more Can anyone help me? Thanks!