Linking problem with X3

Mikael Asplund <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
Hi!

If I take the x3 calc9 example in Boost 1.60 and change in config.hpp from:
typedef x3::with_context<error_handler_tag, std::reference_wrapper<error_handler_type> const, phrase_context_type>::type
...to:
typedef x3::with_context<error_handler_tag, std::reference_wrapper<error_handler_type> const, x3::unused_type>::type
...and also change in main.cpp:
bool success = phrase_parse(iter, end, parser, space, ast);
...to:
bool success = parse(iter, end, parser, ast);
...I get a link problem:

1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl client::parser::parse_rule<class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > >,struct boost::spirit::x3::context<struct boost::spirit::x3::error_handler_tag,class std::reference_wrapper<class boost::spirit::x3::error_handler<class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > > > > const ,struct boost::spirit::x3::unused_type>,struct client::ast::statement_list>(struct boost::spirit::x3::rule<struct client::parser::statement_class,struct client::ast::statement_list,0>,class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > > &,class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > > const &,struct boost::spirit::x3::context<struct boost::spirit::x3::error_handler_tag,class std::reference_wrapper<class boost::spirit::x3::error_handler<class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > > > > const ,struct boost::spirit::x3::unused_type> const &,struct client::ast::statement_list &)" (??$parse_rule@V?$_String_const_iterator@V?$_String_val@U?$_Simple_types@D@std@@@std@@@std@@U?$context@Uerror_handler_tag@x3@spirit@boost@@$$CBV?$reference_wrapper@V?$error_handler@V?$_String_const_iterator@V?$_String_val@U?$_Simple_types@D@std@@@std@@@std@@@x3@spirit@boost@@@std@@Uunused_type@234@@x3@spirit@boost@@Ustatement_list@ast@client@@@parser@client@@YA_NU?$rule@Ustatement_class@parser@client@@Ustatement_list@ast@3@$0A@@x3@spirit@boost@@AEAV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@D@std@@@std@@@std@@AEBV67@AEBU?$context@Uerror_handler_tag@x3@spirit@boost@@$$CBV?$reference_wrapper@V?$error_handler@V?$_String_const_iterator@V?$_String_val@U?$_Simple_types@D@std@@@std@@@std@@@x3@spirit@boost@@@std@@Uunused_type@234@@345@AEAUstatement_list@ast@1@@Z) referenced in function "public: bool __cdecl boost::spirit::x3::rule<struct client::parser::statement_class,struct client::ast::statement_list,0>::parse<class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > >,struct boost::spirit::x3::context<struct boost::spirit::x3::error_handler_tag,class std::reference_wrapper<class boost::spirit::x3::error_handler<class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > > > > const ,struct boost::spirit::x3::unused_type>,struct client::ast::statement_list>(class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > > &,class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > > const &,struct boost::spirit::x3::context<struct boost::spirit::x3::error_handler_tag,class std::reference_wrapper<class boost::spirit::x3::error_handler<class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > > > > const ,struct boost::spirit::x3::unused_type> const &,struct boost::spirit::x3::unused_type,struct client::ast::statement_list &)const " (??$parse@V?$_String_const_iterator@V?$_String_val@U?$_Simple_types@D@std@@@std@@@std@@U?$context@Uerror_handler_tag@x3@spirit@boost@@$$CBV?$reference_wrapper@V?$error_handler@V?$_String_const_iterator@V?$_String_val@U?$_Simple_types@D@std@@@std@@@std@@@x3@spirit@boost@@@std@@Uunused_type@234@@x3@spirit@boost@@Ustatement_list@ast@client@@@?$rule@Ustatement_class@parser@client@@Ustatement_list@ast@3@$0A@@x3@spirit@boost@@QEBA_NAEAV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@D@std@@@std@@@std@@AEBV45@AEBU?$context@Uerror_handler_tag@x3@spirit@boost@@$$CBV?$reference_wrapper@V?$error_handler@V?$_String_const_iterator@V?$_String_val@U?$_Simple_types@D@std@@@std@@@std@@@x3@spirit@boost@@@std@@Uunused_type@234@@123@Uunused_type@123@AEAUstatement_list@ast@client@@@Z)

Ignore the fact that my change obviously will screw up the parsing (In my real code I parse tokens without whitespaces and don't want skippers, and I get similar problem with linking).
The question is why is this screws up the linking (BOOST_SPIRIT_INSTANTIATE macro seems to be instantiating the needed type)?

Anyone out there with more experience with this? I'm utterly confused, and I've been trying what I can think of for days!

Regards,
   Mikael

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140

_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.