Project

General

Profile

Linker Error in Qt Creator

Added by Roman Zotter over 15 years ago

Hey, got this problem.

Im want to test Wt, but im getting this 3 linking errors:

wtd.lib(random_device.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_imp_CryptAcquireContextA@20" in Funktion ""public:

__thiscall boost::random_device::impl::impl(class > std::basic_string<char,struct std::char_traits,class std::allocator > const &)\"

(??0implrandom\_device@boost@QAEABV?$basic\_string@DU?$char\_traits@D@std@V?$allocatorD@2@std``Z)".
wtd.lib(random_device.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__CryptReleaseContext
8\" in Funktion ""public:

__thiscall boost::random_device::impl::~impl

(void)\" (??1implrandom\_device@boost@QAEXZ)".
wtd.lib(random_device.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__CryptGenRandom
12\" in Funktion ""public:

unsigned int __thiscall

boost::random_device::impl::next(void)\" (?nextimpl@random\_device@boost@QAEIXZ)\".

I think this is the random library, but im not sure. Someone here, who can help me?


Replies (6)

RE: Linker Error in Qt Creator - Added by Wim Dumon over 15 years ago

Looks like you did not link with Advapi32.lib

Wt uses windows' cryptographic library to generate the random numbers.

http://msdn.microsoft.com/en-us/library/aa379942%28VS.85%29.aspx

cmake should do this automatically - did you use cmake to generate your build files?

RE: Linker Error in Qt Creator - Added by Roman Zotter over 15 years ago

Wim Dumon wrote:

Looks like you did not link with Advapi32.lib

Wt uses windows' cryptographic library to generate the random numbers.

http://msdn.microsoft.com/en-us/library/aa379942%28VS.85%29.aspx

cmake should do this automatically - did you use cmake to generate your build files?

yeah, thanks compiling works now, but now the application crashes, when it starts.

and throws some exception

0 kernel32!RaiseException
1 MSVCR90D!CxxThrowException
2 lig!boost::throw_exception<std::runtime_error>
3 lig!boost::re_detail::raise_runtime_error
4 lig!boost::re_detail::w32_regex_traits_char_layer<char>::init
5 lig!boost::re_detail::w32_regex_traits_implementation<char>::w32_regex_traits_implementation<char>
6 lig!boost::object_cache<unsigned long,boost::re_detail::w32_regex_traits_implementation<char> >::do_get
7 lig!boost::object_cache<unsigned long,boost::re_detail::w32_regex_traits_implementation<char> >::get
8 lig!boost::re_detail::create_w32_regex_traits<char>
9 lig!boost::re_detail::regex_data<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >::regex_data<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >
10 lig!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >::do_assign
11 lig!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char> > >
12 lig!Wt::`dynamic initializer for 'AlignVerticalMask''
13 MSVCR90D!initterm
14 F:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:501 (lig!__tmainCRTStartup)
15 F:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:403 (lig!WinMainCRTStartup)
16 kernel32!RegisterWaitForInputIdle

what could be the reason for this??

RE: Linker Error in Qt Creator - Added by Wim Dumon over 15 years ago

Looks like an error in the initializers of static objects... Looking at the source code of boost 1.40, it seems that boost tries to load some kind of dll dynamically and it fails.

My best guess is that this is caused by an illegal build. Are you sure you're linking against the correct version of the boost libraries (wrt static/dynamic debug/optimized runtime DLLs, aka /MD, /MT, /MDd, /MTd), so that your entire executable (and related dlls) use the same runtime versions? The cmake script takes care of this, but as you had problems with linking against advapi, I assume you deviated from the instructions posted on our wiki at http://www.webtoolkit.eu/wt/wiki/index.php/Installing_Wt_2.1_on_MS_Windows Is that the case, and if so, does it work when you follow the wiki instructions? If you are following the wiki instructions, I'm very interested in your wt version, boost version and cmake version so that I can reproduce this here.

A different thing is that your stack trace indicates that the dynamic initializer for AlignVerticalMask would call regex functions, which is weird. No idea why this would happen.

RE: Linker Error in Qt Creator - Added by Roman Zotter over 15 years ago

Now i recompiled Boost and Wt using cmake like in the install instructions, but now i get another linking error:

boost_signals-vc90-mt-gd-1_40.lib(boost_signals-vc90-mt-gd-1_40.dll) : error LNK2005: "public: __thiscall boost::signals::detail::slot_base::~slot_base(void)" (??1slot_basedetail@signals@boost@QAEXZ) ist bereits in ligmain.obj definiert.
boost_signals-vc90-mt-gd-1_40.lib(boost_signals-vc90-mt-gd-1_40.dll) : error LNK2005: "public: class boost::shared_ptr<struct boost::signals::detail::slot_base::data_t> __thiscall boost::signals::detail::slot_base::get_data(void)const " (?get_data
slot_basedetail@signals@boost@QBE?AV?$shared_ptrUdata\_t@slot\_base@detail@signals@boost@@4XZ) ist bereits in ligmain.obj definiert.
boost_signals-vc90-mt-gd-1_40.lib(boost_signals-vc90-mt-gd-1_40.dll) : error LNK2005: "public: __thiscall boost::signals::connection::connection(void)" (??0connection
signalsboost@QAEXZ) ist bereits in ligmain.obj definiert.
boost_signals-vc90-mt-gd-1_40.lib(boost_signals-vc90-mt-gd-1_40.dll) : error LNK2005: "public: bool __thiscall boost::signals::detail::slot_base::is_active(void)const " (?is_active
slot_basedetail@signals@boost@QBE_NXZ) ist bereits in ligmain.obj definiert.

boost_signals-vc90-mt-gd-1_40.lib(boost_signals-vc90-mt-gd-1_40.dll) : error LNK2005: "public: __thiscall boost::signals::detail::slot_base::slot_base(void)" (??0slot_basedetail@signals@boost@QAEXZ) ist bereits in ligmain.obj definiert.
boost_signals-vc90-mt-gd-1_40.lib(boost_signals-vc90-mt-gd-1_40.dll) : error LNK2005: "public: bool __thiscall boost::signals::connection::connected(void)const " (?connected
connectionsignals@boost@QBE_NXZ) ist bereits in ligmain.obj definiert.

i suppose that there is a library which shouldnt be linked, but could you tell me which?

Wim Dumon wrote:

Looks like an error in the initializers of static objects... Looking at the source code of boost 1.40, it seems that boost tries to load some kind of dll dynamically and it fails.

My best guess is that this is caused by an illegal build. Are you sure you're linking against the correct version of the boost libraries (wrt static/dynamic debug/optimized runtime DLLs, aka /MD, /MT, /MDd, /MTd), so that your entire executable (and related dlls) use the same runtime versions? The cmake script takes care of this, but as you had problems with linking against advapi, I assume you deviated from the instructions posted on our wiki at http://www.webtoolkit.eu/wt/wiki/index.php/Installing_Wt_2.1_on_MS_Windows Is that the case, and if so, does it work when you follow the wiki instructions? If you are following the wiki instructions, I'm very interested in your wt version, boost version and cmake version so that I can reproduce this here.

A different thing is that your stack trace indicates that the dynamic initializer for AlignVerticalMask would call regex functions, which is weird. No idea why this would happen.

RE: Linker Error in Qt Creator - Added by Wim Dumon over 15 years ago

What is ligmain.obj?

Do the examples in Wt compile?

You seem to be linking against boost dlls, while Wt by default links against the static boost library... maybe you need to search the source of the problem there? Can't you simply omit boost_signals from your library list?

Wim.

RE: Linker Error in Qt Creator - Added by Roman Zotter over 15 years ago

Yeah it was because I was linking against the boost dlls.

Thanks, now its working .

    (1-6/6)