Linking problem with X3

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Linking problem with X3

Mikael Asplund

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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with X3

Joel de Guzman
On 10/03/2016 6:30 PM, Mikael Asplund wrote:

> Hi!
>
> If I take the x3 calc9 example in Boost 1.60 and change in config.hpp from:
>
> typedefx3::with_context<error_handler_tag, std::/reference_wrapper/<error_handler_type>
> const, phrase_context_type>::/type/
>
> ...to:
>
> typedefx3::with_context<error_handler_tag, std::/reference_wrapper/<error_handler_type>
> const, x3::unused_type>::/type/
>
> ...and also change in main.cpp:
>
> boolsuccess= phrase_parse(iter, end, parser, /space/, ast);
>
> ...to:
>
> boolsuccess= parse(iter, end, parser, ast);
>
> ...I get a link problem:
>
[...]
>
> 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!

     typedef x3::with_context<
         error_handler_tag
       , std::reference_wrapper<error_handler_type> const>::type
     context_type;

(i.e. don't inject the x3::unused_type context)

Regards,
--
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with X3

Mikael Asplund
Hi!

Thank you for your help! Unfortunately removing the unused_type didn't help at all.
In fact, it doesn't change anything, strangely. I had expected at least the type in the error message to change slightly, but in fact it's byte for byte identical still... X3 automatically add it, if it's not there, maybe?

Either way, I'm no neared my goal, and still as confused :-)

Regards,
  Mikael

-----Original Message-----
From: Joel de Guzman [mailto:[hidden email]]
Sent: Friday, March 11, 2016 00:57
To: [hidden email]
Subject: Re: [Spirit-general] Linking problem with X3

On 10/03/2016 6:30 PM, Mikael Asplund wrote:

> Hi!
>
> If I take the x3 calc9 example in Boost 1.60 and change in config.hpp from:
>
> typedefx3::with_context<error_handler_tag,
> std::/reference_wrapper/<error_handler_type>
> const, phrase_context_type>::/type/
>
> ...to:
>
> typedefx3::with_context<error_handler_tag,
> std::/reference_wrapper/<error_handler_type>
> const, x3::unused_type>::/type/
>
> ...and also change in main.cpp:
>
> boolsuccess= phrase_parse(iter, end, parser, /space/, ast);
>
> ...to:
>
> boolsuccess= parse(iter, end, parser, ast);
>
> ...I get a link problem:
>
[...]
>
> 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!

     typedef x3::with_context<
         error_handler_tag
       , std::reference_wrapper<error_handler_type> const>::type
     context_type;

(i.e. don't inject the x3::unused_type context)

Regards,
--
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with X3

Joel de Guzman
On 11/03/2016 9:40 AM, Mikael Asplund wrote:
> Hi!
>
> Thank you for your help! Unfortunately removing the unused_type didn't help at all. In
> fact, it doesn't change anything, strangely. I had expected at least the type in the
error message to change slightly, but in fact it's byte for byte identical still... X3
automatically add it, if it's not there, maybe?
>

It's an x3 bug. It's fixed now in devel branch.

Regards,
--
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with X3

Mikael Asplund
Excellent! Thanks! :)

-----Original Message-----
From: Joel de Guzman [mailto:[hidden email]]
Sent: Friday, March 11, 2016 16:26
To: [hidden email]
Subject: Re: [Spirit-general] Linking problem with X3

On 11/03/2016 9:40 AM, Mikael Asplund wrote:
> Hi!
>
> Thank you for your help! Unfortunately removing the unused_type didn't
> help at all. In fact, it doesn't change anything, strangely. I had
> expected at least the type in the
error message to change slightly, but in fact it's byte for byte identical still... X3 automatically add it, if it's not there, maybe?
>

It's an x3 bug. It's fixed now in devel branch.

Regards,
--
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with X3

Mikael Asplund
Hi!

To follow up on the bug, I dug out the fix and applied it to my 1.60 boost, and now my real project builds too! Excellent!
Can I could on this fix to ship in boost 1.61? :)

  /Mikael

-----Original Message-----
From: Mikael Asplund [mailto:[hidden email]]
Sent: Friday, March 11, 2016 17:28
To: Spirit General Mailing List <[hidden email]>
Subject: Re: [Spirit-general] Linking problem with X3

Excellent! Thanks! :)

-----Original Message-----
From: Joel de Guzman [mailto:[hidden email]]
Sent: Friday, March 11, 2016 16:26
To: [hidden email]
Subject: Re: [Spirit-general] Linking problem with X3

On 11/03/2016 9:40 AM, Mikael Asplund wrote:
> Hi!
>
> Thank you for your help! Unfortunately removing the unused_type didn't
> help at all. In fact, it doesn't change anything, strangely. I had
> expected at least the type in the
error message to change slightly, but in fact it's byte for byte identical still... X3 automatically add it, if it's not there, maybe?
>

It's an x3 bug. It's fixed now in devel branch.

Regards,
--
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with X3

Joel de Guzman
On 14/03/2016 4:43 AM, Mikael Asplund wrote:
> Hi!
>

> To follow up on the bug, I dug out the fix and applied it to my 1.60 boost, and now my
real project builds too! Excellent!
> Can I could on this fix to ship in boost 1.61? :)

Wonderful! I think it's too late. But I'll see what I can do.

Regards,
--
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/


------------------------------------------------------------------------------
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=278785231&iu=/4140
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general