Hi,
I just downloaded, compiled and install boost.It seems like the installation process worked fine and I successfully compiled a program using boost (boost.log for instance). But when I try to compile an example writed by the developpers of boost.spirit, it fail ! It doesn't seem like it's an inclusion resolution problems, I don't know what to do. Please help me.
Here is my code (I paste it from this page) :
#include <stdio.h>#include <stdlib.h>
#include <boost/spirit/include/lex_lexertl.hpp>#include <boost/spirit/include/phoenix_operator.hpp>#include <boost/spirit/include/phoenix_statement.hpp>#include <boost/spirit/include/phoenix_algorithm.hpp>#include <boost/spirit/include/phoenix_core.hpp>#define BOOST_ALL_DYN_LINK//without it boost.log glitch#include <boost/log/trivial.hpp>
int main(){ BOOST_LOG_TRIVIAL(trace) << "boost.log is working !"; typedef lex::lexertl::token<char const*, lex::omit, boost::mpl::false_> token_type;
typedef lex::lexertl::actor_lexer<token_type> lexer_type;
word_count_tokens<lexer_type> word_count_lexer;
std::string str (read_from_file("mainwindow.cpp.txt")); char const* first = str.c_str(); char const* last = &first[str.size()];
lexer_type::iterator_type iter = word_count_lexer.begin(first, last); lexer_type::iterator_type end = word_count_lexer.end();
while (iter != end && token_is_valid(*iter)) ++iter;
if (iter == end) { std::cout << "lines: " << word_count_lexer.l << ", words: " << word_count_lexer.w << ", characters: " << word_count_lexer.c << "\n"; } else { std::string rest(first, last); std::cout << "Lexical analysis failed\n" << "stopped at: \"" << rest << "\"\n"; } return 0; }}
And here is my error log :
11:32:39 **** Incremental Build of configuration Default for project synthax_analyser ****make all g++ -O2 -g -Wall -fmessage-length=0 -c -o synthax_analyser.o synthax_analyser.cppsynthax_analyser.cpp: In function ‘int main()’:synthax_analyser.cpp:24:4: error: ‘lex’ does not name a typesynthax_analyser.cpp:27:10: error: ‘lex’ does not name a typesynthax_analyser.cpp:29:2: error: ‘word_count_tokens’ was not declared in this scopesynthax_analyser.cpp:29:20: error: ‘lexer_type’ was not declared in this scopesynthax_analyser.cpp:29:20: note: suggested alternative:In file included from /usr/local/include/boost/spirit/home/lex/meta_compiler.hpp:16:0, from /usr/local/include/boost/spirit/home/lex/reference.hpp:14, from /usr/local/include/boost/spirit/home/lex/lexer/token_def.hpp:21, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:14, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/spirit/home/lex/lexer_type.hpp:20:12: note: ‘boost::spirit::lex::lexer_type’synthax_analyser.cpp:29:32: error: ‘word_count_lexer’ was not declared in this scopesynthax_analyser.cpp:31:54: error: ‘read_from_file’ was not declared in this scopesynthax_analyser.cpp:35:2: error: ‘lexer_type’ is not a class or namespacesynthax_analyser.cpp:35:28: error: expected ‘;’ before ‘iter’synthax_analyser.cpp:36:3: error: ‘lexer_type’ is not a class or namespacesynthax_analyser.cpp:36:29: error: expected ‘;’ before ‘end’synthax_analyser.cpp:38:9: error: ‘iter’ was not declared in this scopesynthax_analyser.cpp:38:17: error: ‘end’ was not declared in this scopesynthax_analyser.cpp:38:17: note: suggested alternatives:In file included from /usr/local/include/boost/range/empty.hpp:20:0, from /usr/local/include/boost/proto/functional/range/empty.hpp:12, from /usr/local/include/boost/proto/functional/range.hpp:13, from /usr/local/include/boost/proto/functional.hpp:14, from /usr/local/include/boost/proto/proto.hpp:16, from /usr/local/include/boost/spirit/home/support/terminal.hpp:18, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/range/end.hpp:106:61: note: ‘boost::range_adl_barrier::end’In file included from /usr/local/include/boost/fusion/container/list/cons.hpp:14:0, from /usr/local/include/boost/fusion/iterator/segmented_iterator.hpp:13, from /usr/local/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp:11, from /usr/local/include/boost/fusion/sequence/intrinsic/begin.hpp:17, from /usr/local/include/boost/fusion/container/vector/vector10.hpp:15, from /usr/local/include/boost/fusion/container/vector.hpp:12, from /usr/local/include/boost/fusion/include/vector.hpp:10, from /usr/local/include/boost/spirit/home/phoenix/core/limits.hpp:73, from /usr/local/include/boost/spirit/home/phoenix/core.hpp:11, from /usr/local/include/boost/spirit/include/phoenix_core.hpp:14, from /usr/local/include/boost/spirit/home/support/terminal.hpp:16, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/fusion/sequence/intrinsic/end.hpp:89:5: note: ‘boost::fusion::end’In file included from /usr/local/include/boost/fusion/sequence/intrinsic/begin.hpp:13:0, from /usr/local/include/boost/fusion/container/vector/vector10.hpp:15, from /usr/local/include/boost/fusion/container/vector.hpp:12, from /usr/local/include/boost/fusion/include/vector.hpp:10, from /usr/local/include/boost/spirit/home/phoenix/core/limits.hpp:73, from /usr/local/include/boost/spirit/home/phoenix/core.hpp:11, from /usr/local/include/boost/spirit/include/phoenix_core.hpp:14, from /usr/local/include/boost/spirit/home/support/terminal.hpp:16, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/fusion/sequence/intrinsic_fwd.hpp:67:16: note: ‘boost::fusion::result_of::end’In file included from /usr/local/include/boost/fusion/support/sequence_base.hpp:11:0, from /usr/local/include/boost/fusion/container/vector/vector10.hpp:11, from /usr/local/include/boost/fusion/container/vector.hpp:12, from /usr/local/include/boost/fusion/include/vector.hpp:10, from /usr/local/include/boost/spirit/home/phoenix/core/limits.hpp:73, from /usr/local/include/boost/spirit/home/phoenix/core.hpp:11, from /usr/local/include/boost/spirit/include/phoenix_core.hpp:14, from /usr/local/include/boost/spirit/home/support/terminal.hpp:16, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/mpl/begin_end_fwd.hpp:23:38: note: ‘boost::mpl::end’In file included from /usr/local/include/boost/proto/functional/range.hpp:14:0, from /usr/local/include/boost/proto/functional.hpp:14, from /usr/local/include/boost/proto/proto.hpp:16, from /usr/local/include/boost/spirit/home/support/terminal.hpp:18, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/proto/functional/range/end.hpp:19:12: note: ‘boost::proto::functional::end’In file included from /usr/local/include/boost/range/empty.hpp:20:0, from /usr/local/include/boost/proto/functional/range/empty.hpp:12, from /usr/local/include/boost/proto/functional/range.hpp:13, from /usr/local/include/boost/proto/functional.hpp:14, from /usr/local/include/boost/proto/proto.hpp:16, from /usr/local/include/boost/spirit/home/support/terminal.hpp:18, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/range/end.hpp:106:61: note: ‘boost::range_adl_barrier::end’In file included from /usr/local/include/boost/spirit/home/support/string_traits.hpp:16:0, from /usr/local/include/boost/spirit/home/support/nonterminal/expand_arg.hpp:20, from /usr/local/include/boost/spirit/home/support/context.hpp:18, from /usr/local/include/boost/spirit/home/qi/domain.hpp:18, from /usr/local/include/boost/spirit/home/qi/parser.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/token_def.hpp:17, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:14, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/spirit/home/support/container.hpp:445:5: note: ‘boost::spirit::traits::end’In file included from /usr/local/include/boost/spirit/home/support/handles_container.hpp:14:0, from /usr/local/include/boost/spirit/home/lex/lexer/token_def.hpp:16, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:14, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/spirit/home/support/attributes_fwd.hpp:43:12: note: ‘boost::spirit::result_of::end’In file included from /usr/local/include/boost/spirit/home/support/info.hpp:17:0, from /usr/local/include/boost/spirit/home/lex/lexer/token_def.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:14, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/foreach.hpp:730:1: note: ‘boost::foreach_detail_::end’synthax_analyser.cpp:38:44: error: ‘token_is_valid’ was not declared in this scopesynthax_analyser.cpp:38:44: note: suggested alternatives:In file included from /usr/local/include/boost/spirit/home/lex/lexer/lexertl/lexer.hpp:20:0, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:16, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/spirit/home/lex/lexer/lexertl/token.hpp:415:5: note: ‘boost::spirit::lex::lexertl::token_is_valid’In file included from /usr/local/include/boost/spirit/home/lex/lexer/lexertl/iterator.hpp:18:0, from /usr/local/include/boost/spirit/home/lex/lexer/lexertl/lexer.hpp:23, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:16, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp:19:21: note: ‘boost::spirit::iterator_policies::split_functor_input_is_valid_test_::token_is_valid’synthax_analyser.cpp:41:7: error: ‘iter’ was not declared in this scopesynthax_analyser.cpp:41:15: error: ‘end’ was not declared in this scopesynthax_analyser.cpp:41:15: note: suggested alternatives:In file included from /usr/local/include/boost/range/empty.hpp:20:0, from /usr/local/include/boost/proto/functional/range/empty.hpp:12, from /usr/local/include/boost/proto/functional/range.hpp:13, from /usr/local/include/boost/proto/functional.hpp:14, from /usr/local/include/boost/proto/proto.hpp:16, from /usr/local/include/boost/spirit/home/support/terminal.hpp:18, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/range/end.hpp:106:61: note: ‘boost::range_adl_barrier::end’In file included from /usr/local/include/boost/fusion/container/list/cons.hpp:14:0, from /usr/local/include/boost/fusion/iterator/segmented_iterator.hpp:13, from /usr/local/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp:11, from /usr/local/include/boost/fusion/sequence/intrinsic/begin.hpp:17, from /usr/local/include/boost/fusion/container/vector/vector10.hpp:15, from /usr/local/include/boost/fusion/container/vector.hpp:12, from /usr/local/include/boost/fusion/include/vector.hpp:10, from /usr/local/include/boost/spirit/home/phoenix/core/limits.hpp:73, from /usr/local/include/boost/spirit/home/phoenix/core.hpp:11, from /usr/local/include/boost/spirit/include/phoenix_core.hpp:14, from /usr/local/include/boost/spirit/home/support/terminal.hpp:16, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/fusion/sequence/intrinsic/end.hpp:89:5: note: ‘boost::fusion::end’In file included from /usr/local/include/boost/fusion/sequence/intrinsic/begin.hpp:13:0, from /usr/local/include/boost/fusion/container/vector/vector10.hpp:15, from /usr/local/include/boost/fusion/container/vector.hpp:12, from /usr/local/include/boost/fusion/include/vector.hpp:10, from /usr/local/include/boost/spirit/home/phoenix/core/limits.hpp:73, from /usr/local/include/boost/spirit/home/phoenix/core.hpp:11, from /usr/local/include/boost/spirit/include/phoenix_core.hpp:14, from /usr/local/include/boost/spirit/home/support/terminal.hpp:16, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/fusion/sequence/intrinsic_fwd.hpp:67:16: note: ‘boost::fusion::result_of::end’In file included from /usr/local/include/boost/fusion/support/sequence_base.hpp:11:0, from /usr/local/include/boost/fusion/container/vector/vector10.hpp:11, from /usr/local/include/boost/fusion/container/vector.hpp:12, from /usr/local/include/boost/fusion/include/vector.hpp:10, from /usr/local/include/boost/spirit/home/phoenix/core/limits.hpp:73, from /usr/local/include/boost/spirit/home/phoenix/core.hpp:11, from /usr/local/include/boost/spirit/include/phoenix_core.hpp:14, from /usr/local/include/boost/spirit/home/support/terminal.hpp:16, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/mpl/begin_end_fwd.hpp:23:38: note: ‘boost::mpl::end’In file included from /usr/local/include/boost/proto/functional/range.hpp:14:0, from /usr/local/include/boost/proto/functional.hpp:14, from /usr/local/include/boost/proto/proto.hpp:16, from /usr/local/include/boost/spirit/home/support/terminal.hpp:18, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/proto/functional/range/end.hpp:19:12: note: ‘boost::proto::functional::end’In file included from /usr/local/include/boost/range/empty.hpp:20:0, from /usr/local/include/boost/proto/functional/range/empty.hpp:12, from /usr/local/include/boost/proto/functional/range.hpp:13, from /usr/local/include/boost/proto/functional.hpp:14, from /usr/local/include/boost/proto/proto.hpp:16, from /usr/local/include/boost/spirit/home/support/terminal.hpp:18, from /usr/local/include/boost/spirit/home/support/common_terminals.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/terminals.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:13, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/range/end.hpp:106:61: note: ‘boost::range_adl_barrier::end’In file included from /usr/local/include/boost/spirit/home/support/string_traits.hpp:16:0, from /usr/local/include/boost/spirit/home/support/nonterminal/expand_arg.hpp:20, from /usr/local/include/boost/spirit/home/support/context.hpp:18, from /usr/local/include/boost/spirit/home/qi/domain.hpp:18, from /usr/local/include/boost/spirit/home/qi/parser.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer/token_def.hpp:17, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:14, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/spirit/home/support/container.hpp:445:5: note: ‘boost::spirit::traits::end’In file included from /usr/local/include/boost/spirit/home/support/handles_container.hpp:14:0, from /usr/local/include/boost/spirit/home/lex/lexer/token_def.hpp:16, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:14, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/spirit/home/support/attributes_fwd.hpp:43:12: note: ‘boost::spirit::result_of::end’In file included from /usr/local/include/boost/spirit/home/support/info.hpp:17:0, from /usr/local/include/boost/spirit/home/lex/lexer/token_def.hpp:15, from /usr/local/include/boost/spirit/home/lex/lexer.hpp:14, from /usr/local/include/boost/spirit/home/lex.hpp:13, from /usr/local/include/boost/spirit/home/lex/lexer_lexertl.hpp:15, from /usr/local/include/boost/spirit/include/lex_lexertl.hpp:16, from synthax_analyser.cpp:12:/usr/local/include/boost/foreach.hpp:730:1: note: ‘boost::foreach_detail_::end’synthax_analyser.cpp: At global scope:synthax_analyser.cpp:54:1: error: expected declaration before ‘}’ tokenmake: *** [synthax_analyser.o] Error 1
Cordialy,Guillaume Bersac237bis rue de Pessac33000 Bordeaux06.65.30.89.43