[spirit,regex] Linking problems in VS 2008

I am using regex_p parser in Spirit. This uses Boost.Regex. The code
compiles fine but does not link. Error messages are (debug mode, static
linking, Boost 1.42):
--------------------
1>configuration.obj : error LNK2019: unresolved external symbol "public:
void __thiscall boost::re_detail::raw_storage::resize(unsigned int)"
(?resize@raw_storage@re_detail@boost@@QAEXI@Z) referenced in function
"public: void * __thiscall boost::re_detail::raw_storage::extend(unsigned
int)" (?extend@raw_storage@re_detail@boost@@QAEPAXI@Z)
1>configuration.obj : error LNK2019: unresolved external symbol "public:
void * __thiscall boost::re_detail::raw_storage::insert(unsigned
int,unsigned int)" (?insert@raw_storage@re_detail@boost@@QAEPAXII@Z)
referenced in function "public: struct boost::re_detail::re_syntax_base *
__thiscall boost::re_detail::basic_regex_creator
::insert_state(int,enum boost::re_detail::syntax_element_type,unsigned int)" (?insert_state@?$basic_regex_creator@DU?$regex_traits@DV?$cpp_regex_traits@D@boost@@@boost@@@re_detail@boost@@QAEPAUre_syntax_base@23@HW4syntax_element_type@23@I@Z) 1>D:\Studies\Thesis\Debug\prover.exe : fatal error LNK1120: 2 unresolved externals
The interesting thing is that if I turn language extensions on (/Za option) in the project the problem disappears. How can this be solved? Adam Badura

Adam Badura wrote:
I am using regex_p parser in Spirit. This uses Boost.Regex. The code compiles fine but does not link. Error messages are (debug mode, static linking, Boost 1.42): -------------------- 1>configuration.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::re_detail::raw_storage::resize(unsigned int)" (?resize@raw_storage@re_detail@boost@@QAEXI@Z) referenced in function "public: void * __thiscall boost::re_detail::raw_storage::extend(unsigned int)" (?extend@raw_storage@re_detail@boost@@QAEPAXI@Z) 1>configuration.obj : error LNK2019: unresolved external symbol "public: void * __thiscall boost::re_detail::raw_storage::insert(unsigned int,unsigned int)" (?insert@raw_storage@re_detail@boost@@QAEPAXII@Z) referenced in function "public: struct boost::re_detail::re_syntax_base * __thiscall boost::re_detail::basic_regex_creator
::insert_state(int,enum boost::re_detail::syntax_element_type,unsigned int)" (?insert_state@?$basic_regex_creator@DU?$regex_traits@DV?$cpp_regex_traits@D@boost@@@boost@@@re_detail@boost@@QAEPAUre_syntax_base@23@HW4syntax_element_type@23@I@Z)
1>D:\Studies\Thesis\Debug\prover.exe : fatal error LNK1120: 2 unresolved externals --------------------
The interesting thing is that if I turn language extensions on (/Za option) in the project the problem disappears.
I believe this option changes ABI, therefore both your project and Boost.Regex must be build with the same value of this option. Does this help? - Volodya

I believe this option changes ABI, therefore both your project and Boost.Regex must be build with the same value of this option.
Does this help?
How to do that (build Regex with /Za)? To build the library I used bjam. The command line is: -------------------- bjam --build-type=complete toolset=msvc-9.0 stage -------------------- Where to add /Za option? (Or any option in fact.) Adam Badura

Adam Badura wrote:
I believe this option changes ABI, therefore both your project and Boost.Regex must be build with the same value of this option.
Does this help?
How to do that (build Regex with /Za)? To build the library I used bjam. The command line is: -------------------- bjam --build-type=complete toolset=msvc-9.0 stage
Do you really need every single variant included in '--build-type=complete'?
--------------------
Where to add /Za option? (Or any option in fact.)
Does http://www.boost.org/boost-build2/doc/html/bbv2/overview/invocation.html answer your question? It seems like cxxflags=/Za should work. You need to add -a to force full rebuild. - Volodya

Do you really need every single variant included in '--build-type=complete'?
I don't know. Maybe not. But HDD space is this days cheap unlike one's time so it seems simpler to build Boost once (every 3 months) entirely and then never to worry whether I have the needed binaries.
Does
http://www.boost.org/boost-build2/doc/html/bbv2/overview/invocation.html
answer your question? It seems like
cxxflags=/Za
should work. You need to add -a to force full rebuild.
Yes. It did help. It is however a bit surprising as I think it should not help. I don't think /Za changes ABI. I still think that there is some other kind of error there but I am not as sure now. :) Another thing is that somehow less libraries where produced. But still it works now. Adam Badura
participants (2)
-
Adam Badura
-
Vladimir Prus