undefined reference to `std::basic_stringstream' from static library on CentOS7
NickName:abhi Ask DateTime:2022-03-03T18:03:43

undefined reference to `std::basic_stringstream' from static library on CentOS7

I am building my C++ code on CentOS7/gcc5.5 for a project which is trying to link a static library during the linking process. To be more precise, its a .net library installed as part of .net sdk version 6.0.

Its present here /usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/6.0.2/runtimes/linux-x64/native/libnethost.a from where I have copied it to a custom path in my workspace

The main project has more than one static libraries which it tries to link during linking. However only for this libnethost.a I am getting the below errors

/home/customPath/ThirdParty/dotNet/6.0.1/libnethost.a(fx_ver.cpp.o): In function `fx_ver_t::as_str() const': /root/runtime/src/native/corehost/fxr/fx_ver.cpp:73: undefined reference to `std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()' /home/customPath/ThirdParty/dotNet/6.0.1/libnethost.a(fx_ver.cpp.o): In function `fx_ver_t::prerelease_glob() const':

This is the version of C++ present on the system

libstdc++-4.8.5-44.el7.i686
libstdc++-devel-4.8.5-44.el7.x86_64
libstdc++-4.8.5-44.el7.x86_64
libstdc++-devel-4.8.5-44.el7.i686

Excuse me for any obvious mistakes but I am not very clear about how the compiler works with Linux. I read about gcc5 using different ABI compared to previous versions but I am not sure how that works. Please help me figure this out.

Regards Abhishek

Copyright Notice:Content Author:「abhi」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/71335279/undefined-reference-to-stdbasic-stringstream-from-static-library-on-centos7

More about “undefined reference to `std::basic_stringstream' from static library on CentOS7” related questions

undefined reference to std::thread::detach() and others

I am compiling c++-14 code using std::thread class with mingw w64 (gcc 9.3) and the posix threading model (not win32). The linker links with -lpthread -lwinpthread but I nevertheless get: undefined

Show Detail

Undefined reference to std::to_string while linking

I am trying to cross-compile a program with uClibc and I am always getting an error with undefined reference to std::to_string while linking is performed. I already applied the workaround, which sh...

Show Detail

Deleted function std basic_stringstream in linux with g++

I've written the following in windows on Qt IDE and when I run it, it works well, however when I tried to run it on centOS with, I want to run code using threads, in which I'm just tring to load a ...

Show Detail

basic_stringstream and its parent classes

Why is basic_stringstream is derived from basic_iostream and not from basic_istringstream and basic_ostringstream? What all gets derived from basic_istringstream and basic_ostringstream then?

Show Detail

undefined reference to `GradeBook::GradeBook(std::string)

I'm a newbie for C++, I'm currently learning it with the book C++ How To Program 8e. In the section Separating Interface from Implementation they have given an example like this GradeBook.h #incl...

Show Detail

undefined reference to std::experimental::net

the code is like this #include &lt;experimental/net&gt; #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;chrono&gt; namespace net = std::experimental::net; using namespace std::

Show Detail

undefined reference to `std::basic_stringstream' from static library on CentOS7

I am building my C++ code on CentOS7/gcc5.5 for a project which is trying to link a static library during the linking process. To be more precise, its a .net library installed as part of .net sdk v...

Show Detail

Android NDK linker Error:error: undefined reference to std::basic_string

I am currently trying to build a static library of some source c++ files requiring boost. I have been following the hello-libs example and have successfully linked the boost static file dependencie...

Show Detail

undefined reference to `std::basic_string<wchar_t,

I am trying to compile my c++ files using cygwin. \Files are compiled but linking time errors occur These kind of errors... undefined reference to `std::basic_string&lt;wchar_t, std::char_traits&lt;

Show Detail

std::stringstream; move assignment does not leave source in invalid state

According to the documentation, the move assignment operator should leave a source string stream in an invalid state: Moves the string stream. The source stream becomes of invalid state after the

Show Detail