解决undefined reference to `std::__cxx11::basic_stringstream

时间:2025-04-01 09:14:46

报错如下:

lib/: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()@GLIBCXX_3.4.26'

solution:(升级gcc)

#Install and use gcc9

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-9
sudo apt install g++-9
sudo rm /usr/bin/gcc                            
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/gcc-9 /usr/bin/gcc
sudo ln -s /usr/bin/g++-9 /usr/bin/g++

refernce:

/NVIDIA/DALI/issues/1843