Write a boost test whether the installation was successful demo
#include<iostream>
#include<boost/lexical_cast.hpp>
int main(){
int a = boost::lexical_cast<int>("123456");
std::cout << a <<std::endl;
return 0;
}
Compile error
test.cpp:(.text+0x24): undefined reference to `std::cout'
test.cpp:(.text+0x29): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
test.cpp:(.text+0x31): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
test.cpp:(.text+0x39): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccG8Wb2k.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x61): undefined reference to `std::ios_base::Init::Init()'
test.cpp:(.text+0x66): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccG8Wb2k.o: In function `std::exception::exception()':
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…