Poco and openssl linker error with visual studio 2010 c++ project - c++

Trying to link with the static library of Poco throws the following error
1>PocoNetSSLmd.lib(SSLManager.obj) : error LNK2001: unresolved external symbol X509_verify_cert_error_string
1>PocoNetSSLmd.lib(Utility.obj) : error LNK2001: unresolved external symbol X509_verify_cert_error_string
But the libeay32.lib static library to which the project is linked contains the symbols
$ dumpbin /ALL libeay32.lib | grep X509_STORE_CTX_get_error
915B6 _X509_STORE_CTX_get_error
915B6 __imp__X509_STORE_CTX_get_error
9162E _X509_STORE_CTX_get_error_depth
9162E __imp__X509_STORE_CTX_get_error_depth
92C _X509_STORE_CTX_get_error
92D _X509_STORE_CTX_get_error_depth
92C __imp__X509_STORE_CTX_get_error
92D __imp__X509_STORE_CTX_get_error_depth
Symbol name : _X509_STORE_CTX_get_error
Symbol name : _X509_STORE_CTX_get_error_depth
1016 _X509_STORE_CTX_get_error
1017 _X509_STORE_CTX_get_error_depth
The preprocessor symbols POCO_STATIC, POCO_NO_UNWINDOWS, POCO_HAVE_IPv6 are set in the project settings.
How to resolve the issue.

In your Project Properties, on the Linker page, add the path to your POCO libraries to the "Additional Library Entries" page.
Also, on Properties > General > Use of MFC, select "Use MFC in a Static Library"
Depending on which POCO libs you are using, you will probably have to add paths for Poco/Foundation and at least one other POCO lib.

Related

How to resolve an unresolved external symbol error with MSVCRTD.lib

I have a C++ Visual Studio DLL project that has a link error:
MSVCRTD.lib(tncleanup.obj) : error LNK2019: unresolved external symbol __imp__InitializeSListHead#4 referenced in function "void __cdecl __scrt_initialize_type_info(void)" (?__scrt_initialize_type_info##YAXXZ)
I set the Project Properties, Linker, General, Show Progress to "For Libraries Searched" to verify the correct version of MSVCRTD.lib is being referenced.
Look up the unresolved external symbol: InitializeSListHead to find what library it is defined in:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683482(v=vs.85).aspx
Kernel32.lib
In Visual Studio, set the Project Properties, Linker, General, Show Progress to “For Libraries Searched (/VERBOSE:Lib)"
Start a build and examine the output to see the "Searching libraries" referencing "Kernel32.lib".
In my case I found another Kernel32.lib was being referenced incorrectly.

Linker error when trying to reference static library project in Visual Studio 2013

I have two projects in my Visual Studio solution: A (static library .lib project) and B (project that uses A). I have referenced A in B by following the steps:
right click B > properties > common properties > references > add new reference > select A from projects tab
I have set the path for .h files using additional include directories option in properties > Configuration Properties > C/C++ > General
Project A builds successfully when built separately. But on building project B, it show unresolved external symbol errors like follows:
Error 46 error LNK2001: unresolved external symbol __imp____glewActiveTexture c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\OGLDEV_Imported.lib(ogldev_texture.obj) Narovatar
Error 21 error LNK2001: unresolved external symbol __imp____glewAttachShader c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\OGLDEV_Imported.lib(technique.obj) Narovatar
Error 12 error LNK2001: unresolved external symbol __imp____glewBindBuffer c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\ogl_mesh.obj Narovatar
Error 13 error LNK2001: unresolved external symbol __imp____glewBufferData c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\ogl_mesh.obj Narovatar
What could I have left? Any thoughts?
Right click properties -> linker -> general ->additional library directories-> browse for your lib file directory.
Right click properties -> linker -> general ->input-> write your lib file name.
Do not forget to make them both MT or both MD like following:
properties -> C/C++ -> Code generation -> Runtime-library-> change them both to be the same
I have found my answer myself, of course with the help of help from all those who responded. Actually, the project A (.lib project) had all the header files and implementations in the same folder which I was referencing in the project B. So, when all the implementations were already available, I didn't have to link my the .dll output of project A in project B, but just had to refer it.
Another problem was that I had not linked (in project B) the libraries that were required for building project A. Now, its up and running...

LNK2019: Undefined external symbol _Getgloballocale, Visual Studio 2013

I have the following linker error in one project of a Visual Studio 2013 solution:
error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (__imp_?_Getgloballocale#locale#std##SAPEAV_Locimp#12#XZ) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet#V?$ctype#D#std###std##YAAEBV?$ctype#D#0#AEBVlocale#0##Z)
In all projects I linked the run-time library dynamically (/MD).
I considered the hints in the following posts:
C++ linker unresolved external symbols
What libraries do I
need to link my mixed-mode application to?
Boost -
Unresolved external symbols when compiling linking with /MT instead
of /MD
Link error 2001:unresolved external symbol
Linker errors between multiple projects in Visual C++
but was not able to solve this issue.
Actually, I am not even aware of where in the project _Getgloballocale is used. Maybe it would also help to know the lib in which _Getgloballocale is located.
The projects use the following libraries:
cURL
Protobuf
libboost_thread-vc120-mt-1_56.lib
libboost_system-vc120-mt-1_56.lib
libboost_python-vc120-mt-1_56.lib
libboost_filesystem-vc120-mt-1_56.lib
In all projects I linked the run-time library dynamically (/MD).
As others noted, verifying this might be less obvious than appears. For one, some of your libraries might drag in external dependencies that do rely on a mis-matching runtime.
Suggest you link with /VERBOSE on (in your EXE project, properties / linker / general / show progress), and search the output dump for MSVCR. You might catch a different version (msvcr100.lib) or a different configuration (msvcr120d.lib). Also try to search for LIBCMT - that is the library for static linking of the runtime. These typically appear as part of a /DEFAULTLIB linker directive, and you should be able to understand from the dump in which library context this directive is present.
You can also post here the verbose output (or the relevant snippets), and we can try to help interpret it.

mpg123 link error "_read" and "_lseek"

I compile mpg123 lib in win32.
It don't want it linked to MSVCR90.DLL
I change:
C/C++ -> "ignore all default libraries" to YES
add "additional dependencies" ==> libcmt.lib
"C/C++ -> Runtime Library "from "multi-threaded DLL" to "Multi-threaded"
But i still get this error:
Please help me.
readers.obj : error LNK2001: unresolved external symbol _read
readers.obj : error LNK2001: unresolved external symbol _lseek
Perhaps you should be linking to LIBCPMT.LIB which is the CPP standard library.

Debugging Visual Studio linker

I am trying to build an xll addin for Excel using appropriate framwork downloaded from MS website. I am getting the following linker errors:
1>FRAMEWRK.obj : error LNK2001: unresolved external symbol _Excel4
1>FRAMEWRK.obj : error LNK2001: unresolved external symbol _Excel4v#16
I think that these should be defined in XLCALL32.LIB included in the package from MS, but I don't know how to check it. Moreover, added the folder containing this library to the Additional Library Directories, without luck.
Hence my questions:
(1) How can I check what is in XLCALL32.LIB?
(2) How can I see which files the linker is using to see if my library is actually included?
In your project properties, Under Configuration Properties->Linker->Input, you will see 'Additional Dependencies' - these are the files the linker is using. Assuming that _Excel4 and _Excel4v are defined in XLCALL32.LIB (which I think they are), you simply need to ensure that this file is specified in this list.