Is selective header including supposed to work?
Hello, I like Qi, but the compile times are terrible sometimes. My example is similar to this in [1], but it needs 3x as much time to compile. I thought this problem might be omitted by including selectively what is needed. So I went into [1] and replaced #include <boost/spirit/include/qi.hpp> by #include <boost/spirit/include/qi_action.hpp> #include <boost/spirit/include/qi_grammar.hpp> #include <boost/spirit/include/qi_uint.hpp> #include <boost/spirit/include/qi_char.hpp> . I got far, but then, there comes up a long error message, beginning like in [2]. My questions are: * is selectively including from "boost/spirit/include" supposed to work, or should this never be done? * if it should work, what is still left to be included in my case? My version of boost is 1.53. Many thanks on advance. Kind regards, Johannes [1] http://www.boost.org/doc/libs/1_41_0/libs/spirit/example/qi/calc2_ast.cpp [2] [...]/usr/include/boost/spirit/home/qi/nonterminal/rule.hpp:176:13: error: no matching function for call to ‘assertion_failed[...] /usr/include/boost/spirit/home/qi/nonterminal/rule.hpp:176:13: note: candidate is: /usr/include/boost/mpl/assert.hpp:79:5: note: template<bool C> int mpl_::assertion_failed(typename mpl_::assert<C>::type) int assertion_failed( typename assert<C>::type ); ^ /usr/include/boost/mpl/assert.hpp:79:5: note: template argument deduction/substitution failed:[...]
2014-04-12 21:47 GMT+08:00 Johannes Lorenz <johannes89@mailueberfall.de>:
Hello,
I like Qi, but the compile times are terrible sometimes. My example is similar to this in [1], but it needs 3x as much time to compile. I thought this problem might be omitted by including selectively what is needed. So I went into [1] and replaced
#include <boost/spirit/include/qi.hpp>
by
#include <boost/spirit/include/qi_action.hpp> #include <boost/spirit/include/qi_grammar.hpp> #include <boost/spirit/include/qi_uint.hpp> #include <boost/spirit/include/qi_char.hpp> .
I got far, but then, there comes up a long error message, beginning like in [2].
My questions are:
* is selectively including from "boost/spirit/include" supposed to work, or should this never be done?
Yes, it should work.
* if it should work, what is still left to be included in my case?
#include <boost/spirit/include/qi_operator.hpp> BTW, if you care about the compile time, there's Spirit X3 in develope which utilizes c++11/14 and it claims to compile faster.
On 4/12/14, 9:47 PM, Johannes Lorenz wrote:
Hello,
I like Qi, but the compile times are terrible sometimes. My example is similar to this in [1], but it needs 3x as much time to compile. I thought this problem might be omitted by including selectively what is needed. So I went into [1] and replaced
#include <boost/spirit/include/qi.hpp>
by
#include <boost/spirit/include/qi_action.hpp> #include <boost/spirit/include/qi_grammar.hpp> #include <boost/spirit/include/qi_uint.hpp> #include <boost/spirit/include/qi_char.hpp> .
I got far, but then, there comes up a long error message, beginning like in [2].
My questions are:
* is selectively including from "boost/spirit/include" supposed to work, or should this never be done? * if it should work, what is still left to be included in my case?
It should work, but the savings in compile time will be minimal. If you want to reduce compile and build time, follow the example in the compiler tutorial from calc7 up. The trick is to modularize your grammars and put the definitions in separate cpp files (TUs). Regards, -- Joel de Guzman http://www.ciere.com http://boost-spirit.com http://www.cycfi.com/
participants (3)
-
Joel de Guzman
-
Johannes Lorenz
-
TONGARI J