Linking against 32 bit boost libraries - c++

I'm trying to link my project against a couple of boost libraries and I ran into a 32 vs 64 bit problem.
I'm using Visual Studio 2015. I added path to the built boost libraries to VC++ Directories.
Here's the output I get:
2>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall boost::thread::detach(void)" (?detach#thread#boost##QAEXXZ)
2>main.obj : error LNK2001: unresolved external symbol "private: bool __thiscall boost::thread::start_thread_noexcept(void)" (?start_thread_noexcept#thread#boost##AAE_NXZ)
2>main.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ)
2>main.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category#system#boost##YAABVerror_category#12#XZ)
2>main.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall boost::detail::thread_data_base::~thread_data_base(void)" (??1thread_data_base#detail#boost##UAE#XZ)
I'm building boost using bootstrap like this:
b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage32
While searching for the solution I opened libboost_thread-vc140-mt-1_64.lib with a text editor and found functions that linker can't find to look like this ?detach#thread#boost##QEAAXXZ
Some sources explain that QEAAXXZ is a name of a 64-bit compiled function. My linker though expects QAEXXZ (32-bit) as you can see from the output.
Am I building boost correctly for a 32-bit application? If so, why can't my application link against it?

Related

Odd linker errors, couldn't find help anywhere

1>client.obj : error LNK2001: unresolved external symbol __Init_thread_epoch
1>client.obj : error LNK2001: unresolved external symbol __Init_thread_footer
1>client.obj : error LNK2001: unresolved external symbol __Init_thread_header
1>config.obj : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *,unsigned int)" (??3#YAXPAXI#Z)
The project was made using v140 toolset, updated to v142 and this happened. I tried going back to old project version and building it using v140 toolset in newest VS, even tried old VS 2015 and nothing.

Using Boost in a DLL project (ActiveX)

I'm trying to use Boost.Asio on a ActiveX DLL project using Visual Studio 2013.
Not sure what is wrong but when building these error shows up:
Error 34 error LNK2019: unresolved external symbol "class
boost::system::error_category const & __cdecl
boost::system::system_category(void)"
(?system_category#system#boost##YAABVerror_category#12#XZ) referenced
in function "public: __thiscall
boost::system::error_code::error_code(void)"
(??0error_code#system#boost##QAE#XZ) C:\eCompany\activex-dll\maindoor\RESTClient.obj maindoor
Error 35 error LNK2019: unresolved external symbol "class
boost::system::error_category const & __cdecl
boost::system::generic_category(void)"
(?generic_category#system#boost##YAABVerror_category#12#XZ) referenced
in function "void __cdecl boost::system::`dynamic initializer for
'errno_ecat''(void)"
(??__Eerrno_ecat#system#boost##YAXXZ) C:\Projects\eCompany\activex-dll\maindoor\RESTClient.obj maindoor
Error 36 error LNK1120: 2 unresolved
externals C:\Projects\eCompany\activex-dll\maindoor\Debug\maindoorEWI.dll 1 1 maindoor
I already added BOOST_ALL_NO_LIB in the Preprocessor. What could be missing in the project?
The short answer is to do something like this:
C:\local\boost_1_58_0>bjam.exe runtime-link=static
and remove BOOST_ALL_NO_LIB is its set, then build the DLL again. That should fix that.

Unresolved externals using boost::asio(visual studio12, x64)

I've downloaded and installed the boost_1_55_0-msvc-12.0-64.exe executable from here: http://sourceforge.net/projects/boost/files/boost-binaries/1.55.0-build2/.
I extracted the binaries to C:\boost_1_55_0 and added the include and linker directories to visual studio project properties.
Include directory: c:\boost_1_55_0
Link directory: c:\boost_1_55_0\lib64-msvc-12.0
error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ) referenced in function "public: __thiscall boost::system::error_code::error_code(void)"
\error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category#system#boost##YAABVerror_category#12#XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat#system#boost##YAXXZ)
What am I doing wrong?
You're probably using the 32 bit compiler / linker, since you downloaded the 64 bit libs make sure you invoke the 64 bit compiler.

How to compile curl 7.35 and use it in project?

I built libcurl and added it to project (specified include directory, library directory and library to use: libcurl.lib/libcurl_imp.lib - I both tried to compile and link static and dynamic library). In both cases (static/dynamic) I faced following:
1>tmp.obj : error LNK2019: unresolved external symbol _curl_easy_cleanup referenced in function "void __cdecl perform(char *)" (?perform##YAXPAD#Z)
1>tmp.obj : error LNK2019: unresolved external symbol _curl_easy_perform referenced in function "void __cdecl perform(char *)" (?perform##YAXPAD#Z)
1>tmp.obj : error LNK2019: unresolved external symbol _curl_easy_setopt referenced in function "void __cdecl perform(char *)" (?perform##YAXPAD#Z)
1>tmp.obj : error LNK2019: unresolved external symbol _curl_easy_init referenced in function "void __cdecl perform(char *)" (?perform##YAXPAD#Z)
1>C:\Users\Public\Documents\Project\curl-7.35.0\Debug\tmp.exe : fatal error LNK1120: 4 unresolved externals
All solutions I found was different variations of "add libcurl.lib".
Now just to clarify my configuration:
dynamic: include directory specified, library directory specified, libcurl_imp.lib specified as additional dependency, libcurl.dll copied to the directory where executable files should be generated.
static: include directory specified, library directory specified, libcurl.lib specified as additional dependency.
using vs2005
Well, it's silly but I was trying to use x64 library in x32 project.

error LNK2019: unresolved external symbol "public:

I am creating an torrent application using libtorrent in VS 2008. I tried the example given in the link http://www.rasterbar.com/products/libtorrent/examples.html
BUt it is showing me these error....how to solve them?
Linking...
main.obj : error LNK2019: unresolved external symbol "public: __thiscall libtorrent::torrent_info::~torrent_info(void)" (??1torrent_info#libtorrent##QAE#XZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: __thiscall libtorrent::torrent_info::torrent_info(struct libtorrent::lazy_entry const &)" (??0torrent_info#libtorrent##QAE#ABUlazy_entry#1##Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "class std::basic_ostream > & __cdecl libtorrent::operator<<(class std::basic_ostream > &,struct libtorrent::lazy_entry const &)" (??6libtorrent##YAAAV?$basic_ostream#DU?$char_traits#D#std###std##AAV12#ABUlazy_entry#0##Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "int __cdecl libtorrent::lazy_bdecode(char const *,char const *,struct libtorrent::lazy_entry &,int)" (?lazy_bdecode#libtorrent##YAHPBD0AAUlazy_entry#1#H#Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall libtorrent::lazy_entry::clear(void)" (?clear#lazy_entry#libtorrent##QAEXXZ) referenced in function "public: __thiscall libtorrent::lazy_entry::~lazy_entry(void)" (??1lazy_entry#libtorrent##QAE#XZ)
main.obj : error LNK2019: unresolved external symbol "void __cdecl libtorrent::to_hex(char const *,int,char *)" (?to_hex#libtorrent##YAXPBDHPAD#Z) referenced in function "class std::basic_ostream > & __cdecl libtorrent::operator<<(class std::basic_ostream > &,class libtorrent::big_number const &)" (??6libtorrent##YAAAV?$basic_ostream#DU?$char_traits#D#std###std##AAV12#ABVbig_number#0##Z)
main.obj : error LNK2019: unresolved external symbol "public: struct libtorrent::peer_request __thiscall libtorrent::file_storage::map_file(int,__int64,int)const " (?map_file#file_storage#libtorrent##QBE?AUpeer_request#2#H_JH#Z) referenced in function "public: struct libtorrent::peer_request __thiscall libtorrent::torrent_info::map_file(int,__int64,int)const " (?map_file#torrent_info#libtorrent##QBE?AUpeer_request#2#H_JH#Z)
C:\Users\photoshop3\Documents\Visual Studio 2008\Projects\Lib2\Debug\Lib2.exe : fatal error LNK1120: 7 unresolved externals
The .lib is not included in your project. Make sure you are linking it in;
Configuration Properties -> Linker -> Input -> Additional Dependencies
Another altnerative is to simply copy the .lib to your project folder but don't, it's bound to create problems later on.
Sometimes the .lib is not shipped with the library, so you need to compile it yourself.
The README will tell you this. If this is the case, they usually ship with a .sln file you can open and the just compile it into a .lib file which you then reference in your main application, as I wrote above
Have you added the path of header files in the "Configuration Properties" --> "C/C++“ --> "General" --> "Additional Include Directories"?
The link gives you only the sources (including headerfiles) of libtorrent. You should compile this sources to get a .lib file. Add this .lib file to your client:
Configuration Properties/Linker/Input -> Additional Dependencies: libtorrent-rasterbar.lib
The best starting point for compiling should be the README file.
public: isn't the unresolved symbol. It's just there because the linker it trying to tell you that (most) of the unresolved symbols are public member functions.
It looks like you've included the header for "libtorrent", but not linked to the "libtorrent" library.
You have probably not linked with the torrent library or specified the wrong path to it so that the linker cannot find it.
If the input libraries are of 32bit and your are using them in building a 64bit it might be one of the reasons
For me, I had it included in my project, but it turned out that it was a plugin that was designed to not create an instance of in my unit test.