Search code examples
c++boost

Cannot build Boost Wave example


These are my (ones of the many) steps in order to build list_includes example, leading to nowhere:

  1. Download the latest boost from the official site (currently it's 1.67.0, but I also tried 1.66.0), extract it

  2. $ ./bootstrap.sh

  3. $ ./b2 --with-wave --with-program_options --with-filesystem --with-system --with-thread --with-date_time

    I took these dependencies from the Jamfile inside the build directory

  4. $ ./b2 install

  5. $ cd libs/wave/samples/list_includes/build

    Just for demonstrating the path

  6. $ ../../../../../b2

or

  1. $ cd libs/wave/samples/list_includes
  2. $ g++ -o list_includes list_includes.cpp -lboost_wave -lboost_program_options -lboost_filesystem -lboost_system -lboost_thread -lboost_date_time

No matter how I do it, I get this (template arguments are omitted for the sake of readability):

undefined reference to `boost::wave::cpplexer::lexertl::new_lexer_gen<>::new_lexer(__gnu_cxx::__normal_iterator<> const&, __gnu_cxx::__normal_iterator<> const&, boost::wave::util::file_position<> const&, boost::wave::language_support)' collect2: error: ld returned 1 exit status

Now I don't understand why it's complaining about cpplexer as it's the part of the library itself - and the library is built and specified in the command line! Thanks for any help/advice.


Solution

  • Solved this nightmare... The traitor is lexertl_interface.hpp !

    Insert in there the following include: #include <boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp>

    And change lines 70-71:

    return new_lexer_gen::new_lexer(first, last, pos, language);

    to:

    return boost::wave::cpplexer::new_lexer_gen::new_lexer(first, last, pos, language);