0

I'm attempting my first use of Boost anything so I thought I'd start with program_options. I'm developing on a Raspberry Pi running Debian Wheezy. I started by "apt-get install libboost1.49-all" and everything seemed to install correctly. I can see .a and .so libraries in /usr/lib.

/usr/lib/libboost_program_options.a
/usr/lib/libboost_program_options-mt.a -> libboost_program_options.a
/usr/lib/libboost_program_options-mt.so -> libboost_program_options.so.1.49.0
/usr/lib/libboost_program_options.so -> libboost_program_options.so.1.49.0
/usr/lib/libboost_program_options.so.1.49.0

I can compile some example source I found here by using

g++ boost_program_options.cpp -c

but I cannot get anything to link. I've tried explicitly specifying the library path using no -l and got nothing but several pages of undefined reference errors. I tried another example code and got a compile problem that indicated to me that I wasn't using "g++ -std=c++0x" but that's not the problem either. I'm stuck. I've also tried

 g++ -std=c++0x boostme.cpp -o boostme -L/usr/lib -lboost_program_options

I'm just banging my head against the wall at this point. Among the stackoverflow posts I've seen so far, I'm doing everything correctly. My head hurts. ;-)

Just some sample error messages below. Still poking around.

/tmp/ccTbmurt.o: In function `boost::program_options::error_with_option_name::~error_with_option_name()':
boostme.cpp:(.text._ZN5boost15program_options22error_with_option_nameD2Ev[_ZN5boost15program_options22error_with_option_nameD5Ev]+0x118): undefined reference to `vtable for boost::program_options::error_with_option_name'
/tmp/ccTbmurt.o: In function `boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
boostme.cpp:(.text._ZN5boost15program_options16validation_errorC2ENS1_6kind_tERKSsS4_i[_ZN5boost15program_options16validation_errorC5ENS1_6kind_tERKSsS4_i]+0x30): undefined reference to `boost::program_options::validation_error::get_template(boost::program_options::validation_error::kind_t)'
Community
  • 1
  • 1
Kelly Beard
  • 621
  • 1
  • 7
  • 18

1 Answers1

2

Because the signature of that destructor really should be

    ~error_with_option_name() throw() {}

I'm going to look into my crystal ball and say that - maybe - somewhere you might have #define throw() or similar hidden in your codebase.

That, or you might have conflicting version of the header files in your include paths, which do not correspond to the version of the libraries found at link time

sehe
  • 328,274
  • 43
  • 416
  • 565
  • 1
    I think that is the problem. I thought that 1.49 was the greatest version of Boost I could have with this OS that I didn't have to build myself, but I found that 1.50 was available and I installed it. That seems to have done the trick. I did attempt to build 1.57 on the Pi once but it would always get to this one file that I don't remember and the compiler would sit on it forever and peg the CPU so badly that getting keystroke to the machine was darn near impossible. I'll look around in /usr/include and see if I have any 1.57 includes around that shouldn't be there. – Kelly Beard Apr 10 '15 at 14:40
  • Hehehe. That'd be one the BGL implementation files that use Boost Spirit for parsing. Anyways, you can cross compile that, but I admit I never tried – sehe Apr 10 '15 at 14:41