linking errors while separate parser using boost spirit x3

前端 未结 2 1458
独厮守ぢ
独厮守ぢ 2020-12-10 20:53

I am currentyl trying to separate my boost spirit x3 parser into different _def and .cpp files using BOOST_SPIRIT_DEFINE/DECLARE/INSTANTIATE, but I keep getting

2条回答
  •  庸人自扰
    2020-12-10 21:24

    In addition to sehe's answer, let me add that:

    You'll need to be very exact with what you declare and with what you actually use. X3 allows any sort of possible types, but the linker does not.

    Here's a tip: When having linker errors, after BOOST_SPIRIT_INSTANTIATE, declare something like:

    int x = context_type{};
    

    It will be an error, yes, because context_type cannot be converted to an int. But that error will also give you the exact type of your context. Compare it against the linker error and you will see your mistake.

提交回复
热议问题