link error 2005 libboost_regex

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderators: Forum Moderators, Developers

Post Reply
fancypantsorama
Posts: 15
Joined: September 19th, 2017, 11:02 am

link error 2005 libboost_regex

Post by fancypantsorama » September 20th, 2017, 8:54 am

1>------ Build started: Project: wesnoth, Configuration: Release Win32 ------
1> Generating code
1> Finished generating code
1>libboost_regex-vc140-mt-1_65_1.lib(regex.obj) : error LNK2005: "public: __thiscall boost::regex_error::regex_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum boost::regex_constants::error_type,int)" (??0regex_error@boost@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4error_type@regex_constants@1@H@Z) already defined in libboost_regex-vc140-mt-1_64.lib(regex.obj)
1>libboost_regex-vc140-mt-1_65_1.lib(regex.obj) : error LNK2005: "public: __thiscall boost::regex_error::regex_error(enum boost::regex_constants::error_type)" (??0regex_error@boost@@QAE@W4error_type@regex_constants@1@@Z) already defined in libboost_regex-vc140-mt-1_64.lib(regex.obj)
1>libboost_regex-vc140-mt-1_65_1.lib(regex.obj) : error LNK2005: "public: virtual __thiscall boost::regex_error::~regex_error(void)" (??1regex_error@boost@@UAE@XZ) already defined in libboost_regex-vc140-mt-1_64.lib(regex.obj)
1>libboost_regex-vc140-mt-1_65_1.lib(regex.obj) : error LNK2005: "public: void __thiscall boost::regex_error::raise(void)const " (?raise@regex_error@boost@@QBEXXZ) already defined in libboost_regex-vc140-mt-1_64.lib(regex.obj)
1>G:\wesnoth\projectfiles\VC12\\..\..\wesnoth.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========




******************************************************************************************

I followed stacktrace for vc90 and found this as a solution!!

******************************************************************************************


Error message follows:

Linking... libboost_regex-vc90-mt-1_38.lib(w32_regex_traits.obj) : error LNK2005: "void cdecl boost::re_detail::free_module(void *)" (?free_module@re_detail@boost@@YAXPAX@Z) already defined in libboost_regex-vc90-mt-gd-1_38.lib(w32_regex_traits.obj)

libboost_regex-vc90-mt-1_38.lib(w32_regex_traits.obj) : error LNK2005: "private: void thiscall boost::re_detail::w32_regex_traits_char_layer<char>::init(void)" (?init@?$w32_regex_traits_char_layer@D@re_detail@boost@@AAEXXZ) already defined in libboost_regex-vc90-mt-gd-1_38.lib(w32_regex_traits.obj)

libboost_regex-vc90-mt-1_38.lib(regex_traits_defaults.obj) : error LNK2005: "char const * * boost::re_detail::def_coll_names" (?def_coll_names@re_detail@boost@@3PAPBDA) already defined in libboost_regex-vc90-mt-gd-1_38.lib(regex_traits_defaults.obj)

libboost_regex-vc90-mt-1_38.lib(regex_traits_defaults.obj) : error LNK2005: "char const * * boost::re_detail::def_multi_coll" (?def_multi_coll@re_detail@boost@@3PAPBDA) already defined in libboost_regex-vc90-mt-gd-1_38.lib(regex_traits_defaults.obj)

libboost_regex-vc90-mt-1_38.lib(regex.obj) : error LNK2005: "public: thiscall boost::regex_error::regex_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum boost::regex_constants::error_type,int)" (??0regex_error@boost@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4error_type@regex_constants@1@H@Z) already defined in libboost_regex-vc90-mt-gd-1_38.lib(regex.obj)

libboost_regex-vc90-mt-1_38.lib(regex.obj) : error LNK2005: "public: thiscall boost::regex_error::regex_error(enum boost::regex_constants::error_type)" (??0regex_error@boost@@QAE@W4error_type@regex_constants@1@@Z) already defined in libboost_regex-vc90-mt-gd-1_38.lib(regex.obj)

libboost_regex-vc90-mt-1_38.lib(regex.obj) : error LNK2005: "public: virtual thiscall boost::regex_error::~regex_error(void)" (??1regex_error@boost@@UAE@XZ) already defined in libboost_regex-vc90-mt-gd-1_38.lib(regex.obj)

libboost_regex-vc90-mt-1_38.lib(regex.obj) : error LNK2005: "public: void thiscall boost::regex_error::raise(void)const " (?raise@regex_error@boost@@QBEXXZ) already defined in libboost_regex-vc90-mt-gd-1_38.lib(regex.obj)

libboost_regex-vc90-mt-1_38.lib(regex.obj) : error LNK2005: "struct boost::re_detail::mem_block_cache boost::re_detail::block_cache" (?block_cache@re_detail@boost@@3Umem_block_cache@12@A) already defined in libboost_regex-vc90-mt-gd-1_38.lib(regex.obj) LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library

C:\boost_1_38_0\bin\Debug\bcp.exe : fatal error LNK1169: one or more multiply defined symbols found Build log was saved at "​file://c:\boost_1_38_0\tools\bcp\bcp.dir\Debug\BuildLog.htm" bcp - 10 error(s), 1 warning(s)


Also there is a solution if the code was the first mention in config.hpp


I found solution for the trouble with LNK2005. This trouble occured if file <boost/regex/config.h> has the following declaration at line 169

extern template class declspec(dllimport) std::basic_string<wchar_t>;

in place of

extern template class declspec(dllimport) std::basic_string<unsigned short>;

This problem doesn't depends whether or not /Zc:wchar_t compiler switch defined. Please take this issue for you information.

In my config file I have at line 211 is the following:


if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
# include <string>
extern template class __declspec(dllimport) std::basic_string<unsigned short>;
# endif
# ifdef BOOST_MSVC
# pragma warning(pop)
# endif
#endif

Other people found it is working fine!

When I build the boost libraries. I first run b2.exe then do the same compile line for my version of bzip2 and zlib to be.


b2.exe --with-iostreams -s BZIP2_SOURCE=C:Sysbzip2-1.0.6 -s ZLIB_SOURCE=C:Syszlib-1.2.7.


Do you think maybe this is an issue with vs2015 trying to build a 64 bit lib or is there some other process to compiling boost that may be the issue?

Regards-

gfgtdf
Developer
Posts: 1030
Joined: February 10th, 2013, 2:25 pm

Re: link error 2005 libboost_regex

Post by gfgtdf » September 20th, 2017, 9:55 am

Code: Select all

1>libboost_regex-vc140-mt-1_65_1.lib(regex.obj) : error LNK2005: "public: __thiscall boost::regex_error::regex_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum boost::regex_constants::error_type,int)" (??0regex_error@boost@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4error_type@regex_constants@1@H@Z) already defined in libboost_regex-vc140-mt-1_64.lib(regex.obj)
I didn't read the whole post but this strongly looks like you are trying to use different version of boost together (libboost_regex-vc140-mt-1_65_1.lib means 1.65 and libboost_regex-vc140-mt-1_64.lib means 1.64), below in the post also something related to boost 1.38. So the solution is to make sure only one version fo boost is used, look in the librarly search part of your projectfiles and eigher remove the 'bad' directory from that list of rmeove the older boost libraried fron the directory. The wesnoth external package also contains a boost version if you chode to use your self-complied boost instead of the one from external, you have to remove the boost lib files from the wesntoh external lib and include folders.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

fancypantsorama
Posts: 15
Joined: September 19th, 2017, 11:02 am

Re: link error 2005 libboost_regex

Post by fancypantsorama » September 21st, 2017, 9:07 am

I am only using the latest and greatest 1_65_1 or whatever was just released. I haven't checked the source inclusively to see if regex is multiply defined. The post from stack exchange was using vc90 and and older version of boost. I was just wondering if anyone came across this issue as on stacktrace it was a boost bug?

I am using VS2015 Community with this new version of Boost libraries. If you are using VS2015 what version of boost libraries are you using and I will go backwards.

Regards-

gfgtdf
Developer
Posts: 1030
Joined: February 10th, 2013, 2:25 pm

Re: link error 2005 libboost_regex

Post by gfgtdf » September 21st, 2017, 9:22 am

No, your output clearly shows that you have multiple versions of boost installted, find the older versions and remove them. They are likely pat of the wesnoth external package.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

fancypantsorama
Posts: 15
Joined: September 19th, 2017, 11:02 am

Re: link error 2005 libboost_regex

Post by fancypantsorama » September 21st, 2017, 11:55 am

Sorry about that last post. I didn't even see my own ouput from the compiler. I see the version differences between 1_65 and 1_64 stated. Since I am only using 1_65 and it is a fresh install I believe I am going to have to post to boost.org to see if they know why it has multiply defined symbols. It must have the 1_64 version built somewhere and is picking up the path.

Thanks very much Regards-

gfgtdf
Developer
Posts: 1030
Joined: February 10th, 2013, 2:25 pm

Re: link error 2005 libboost_regex

Post by gfgtdf » September 21st, 2017, 1:51 pm

as i said above the 1.64 'installation' was likely part of the external dependecy package that you downloaded to install wesnoth. If you want to use your own boost, you ahev to remvoe the boost files from that folder.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

fancypantsorama
Posts: 15
Joined: September 19th, 2017, 11:02 am

Re: link error 2005 libboost_regex

Post by fancypantsorama » September 22nd, 2017, 1:52 am

Didn't know with the current git pull and external-deps that there would be this other library that was regex from release 64. WIth that out of the way since you so nicely pointed out I had multiply defined symbols in a 65 release and 64 release then the error should be resolved. So if you are using VS2015 liboost 1-65 and have downladed and set your path to the %ROOT%/libs directory. You might experience this issue as the documents state to do!

Thanks for the Help Regards-

fancypantsorama
Posts: 15
Joined: September 19th, 2017, 11:02 am

Re: link error 2005 libboost_regex

Post by fancypantsorama » September 22nd, 2017, 4:56 am

I believe that after the main build when building the wesnoth project. it requires these libboost_regex-vc140-mt-1_64.lib so I guess that I have to rev down the Booost Libraries and use the last release?

Post Reply