I installed boost on ubuntu 10.04 by
sudo apt-get install libboost-dev
I think after that I don\'t need to set any -I and -L flags, so I co
You need to link to the Boost program_options library as not everything in Boost is pure templates:
edd@max:/tmp$ cat bpoex.cpp
#include <iostream>
#include <string>
#include <set>
#include <sstream>
#include <boost/config.hpp>
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
namespace pod = boost::program_options::detail;
int main()
{
//contents
std::stringstream s(
"a = 1\n"
"b = 2\n"
"c = test option\n");
//parameters
std::set<std::string> options;
options.insert("a");
options.insert("b");
options.insert("c");
//parser
for (pod::config_file_iterator i(s, options), e ; i != e; ++i)
{
std::cout << i->value[0] << std::endl;
}
}
edd@max:/tmp$ g++ -o bpoex bpoex.cpp -lboost_program_options
edd@max:/tmp$ ./bpoex
1
2
test option
edd@max:/tmp$