I have this file
#include <boost/program_options.hpp>
namespace po = boost::program_options;
#include <iostream>
using namespace std;
int main(int ac, char* av[])
{
try {
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
;
}
catch(exception& e) {
cerr << "error: " << e.what() << "\n";
return 1;
}
catch(...) {
cerr << "Exception of unknown type!\n";
}
return 0;
}
Now I am trying to compile like this:
g++ -I /usr/include/boost/ -I /usr/include/boost/program_options main.cpp -L /usr/lib/x86_64-linux-gnu/ -lboost_program_options
and I am receiving this
undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string, std::allocator > const&, unsigned int, unsigned int)'
I don't know why it is failing, the library is there and the header file too. What goes wrong? I am using boost 1.55.0
administrator@administrator-VirtualBox:~/l/b$ sudo updatedb
administrator@administrator-VirtualBox:~/l/b$ locate libboost_program_options
/usr/lib/x86_64-linux-gnu/libboost_program_options.a
/usr/lib/x86_64-linux-gnu/libboost_program_options.so
/usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.55.0
sudo updatedb
followed by alocate libboost_program_options
and paste the results of the latter? – Ami Tavory