I have a project in VC++ where I am using libcurl library. Even after adding the library in Additional Dependencies I am facing around 150 unresolved external errors, all majorly for libcurl_a.lib file.
Error -
1>OLDNAMES.lib(open.obi): warning LNK4049: locally defined symbol open imported
1>libcurl_a.lib(mime.obj): error LNK2019: unresolved external symbol imp__feof referenced
1>libcurl_a.lib(mime.obj): error LNK2019: unresolved external symbol imp_access referenced in function Curl_mime_duppart in function _read_part content
1>OLDNAMES.lib(access.obi): error LNK2001: unresolved external symbol imp access
1>libcurl_a.lib(mime.obj): error LNK2019: unresolved external symbolimp_ stat64 referenced in function Curl_nine duppart 1>libcurl_a.lib(strerror.obj): error LNK2019: unresolved external symbolimp_strerror referenced in function Curl strerror
1>libcurl_a.lib(url.obj): error LNK2001: unresolved external symbol imp_strerror
1>1ibcurl_a.lib(telnet.obj): error LNK2001: unresolved external symbol imp_strncpy
1>1ibcurl_a.lib(ftp.obj): error LNK2001: unresolved external symbolimp_strncpy
1>libcurl_alib(curl_sspi.obj): error LNK2001: unresolved external symbolimp_strncpy
1>1ibcurl_s.lib(strerror.obj): error LNK2001: unresolved external symbolimp_strncpy
1>1ibcurl_a.lib(vtis.obj): error LNK2001: unresolved external symbol imp_strncpy 1>1ibcurl_.1ib(url.obj): error LNK2001: unresolved external symbolimp_strncpy
1>libcurl_a.lib(schannel.obj) error LNK 2001: unresolved external symbol_imp_strncpy
1>libcuri_a.lip(strerror.obj) : error LNK2019: unresolved external symbol imp sys_nerr referenced in function Curi strerror
1>libcurl_a.lib(warnless.obj): error LNK2019: unresolved external symbol 1 OLDNAMES1ib(read.obi): error LNK2001: unresolved external symbolimp_read imp_read referenced in function curl_read
111bcurt a.lib/warmless.obj) error LNK2019: unresolved external symbol_imp_write referenced in function curl, weite
1 OLDNAMES-110(write.obi): error LNK2001: unresolved external symbolimp_write
I have solved this problem by building the library with RTLIBCFG=static option.
I am getting LNK2019 error from linking C++ code with the standard library C++ library. I need to know which libraries contain the functions:
is_c_termination_complete,
__acrt_initialize,
__acrt_uninitialize,
__acrt_uninitialize_critical,
__acrt_thread_attach,
__acrt_thread_detach
to include it in the linking process.
I am writing code in C++ with MS Visual Studio community 2017 and Intel Parallel studio xe 2019 update 1 to be integrated in 3rd party software. The 3rd party software provides a "make" option to compile the object files and link them together.
Compilation works fine, linking provides an issue.
The 3rd party software provides an entry to provide basic linker options in the form of a variable. The default options are as follows:
link_sl='LINK', '/nologo', '/NOENTRY', '/INCREMENTAL:NO', '/subsystem:console', '/machine:AMD64',
' /NODEFAULTLIB:LIBC.LIB', '/NODEFAULTLIB:LIBCMT.LIB','/DEFAULTLIB:OLDNAMES.LIB', '/DEFAULTLIB:LIBIFCOREMD.LIB', '/DEFAULTLIB:LIBIFPORTMD.LIB', '/DEFAULTLIB:LIBMMD.LIB', '/DEFAULTLIB:kernel32.lib', '/DEFAULTLIB:user32.lib', '/DEFAULTLIB:advapi32.lib','/FIXED:NO', '/dll','/def:%E', '/out:%U', '%F', '%A', '%L', '%B',
'oldnames.lib', 'user32.lib', 'ws2_32.lib', 'netapi32.lib','advapi32.lib',
'msvcrt.lib', 'vcruntime.lib', 'ucrt.lib']
This gives the following 11 errors when linking:
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_initialize referenced in function __scrt_initialize_crt
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_uninitialize referenced in function __scrt_initialize_crt
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_uninitialize_critical referenced in function __scrt_dllmain_uninitialize_critical
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_thread_attach referenced in function __scrt_dllmain_crt_thread_attach
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_thread_detach referenced in function __scrt_dllmain_crt_thread_attach
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _is_c_termination_complete referenced in function __scrt_dllmain_uninitialize_c
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_initialize referenced in function __scrt_initialize_crt
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize referenced in function __scrt_uninitialize_crt
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize_critical referenced in function __scrt_dllmain_uninitialize_critical
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_attach referenced in function __scrt_dllmain_crt_thread_attach
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_detach referenced in function __scrt_dllmain_crt_thread_detach
Which basically means that I am not including all the necessary libraries.
I already found out that including the library 'libvcruntime.lib' in the options reduces the errors to 6. So, using:
link_sl='LINK', '/nologo', '/NOENTRY', '/INCREMENTAL:NO', '/subsystem:console', '/machine:AMD64',
' /NODEFAULTLIB:LIBC.LIB', '/NODEFAULTLIB:LIBCMT.LIB','/DEFAULTLIB:OLDNAMES.LIB', '/DEFAULTLIB:LIBIFCOREMD.LIB', '/DEFAULTLIB:LIBIFPORTMD.LIB', '/DEFAULTLIB:LIBMMD.LIB', '/DEFAULTLIB:kernel32.lib', '/DEFAULTLIB:user32.lib', '/DEFAULTLIB:advapi32.lib','/FIXED:NO', '/dll','/def:%E', '/out:%U', '%F', '%A', '%L', '%B',
'oldnames.lib', 'user32.lib', 'ws2_32.lib', 'netapi32.lib','advapi32.lib',
'msvcrt.lib', 'vcruntime.lib', 'ucrt.lib',**'libvcruntime.lib'**]
Results in:
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _is_c_termination_complete referenced in function __scrt_dllmain_uninitialize_c
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_initialize referenced in function __scrt_initialize_crt
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize referenced in function __scrt_uninitialize_crt
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize_critical referenced in function __scrt_dllmain_uninitialize_critical
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_attach referenced in function __scrt_dllmain_crt_thread_attach
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_detach referenced in function __scrt_dllmain_crt_thread_detach
Which other libraries do I need to include in the linking process to resolve these?
I have encountered exactly the same problem when working within the framework provided by this 3rd party software. Although I cannot answer directly the question for finding the libraries containing _is_c_termination_complete, I realised it is still possible to make your code work: simply adding a /FORCE flag to your link_sl flag list.
According to MSVC official documentation:
The /FORCE option tells the linker to create a valid .exe file or DLL even if a symbol is referenced but not defined or is multiply defined.
Therefore, LNK2019 error messages will not stop the linker producing the dll library which is critical for the 3rd party software to run. The linker messages would look like:
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _is_c_termination_complete referenced in function __scrt_dllmain_uninitialize_c
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_initialize referenced in function __scrt_initialize_crt
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize referenced in function __scrt_uninitialize_crt
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize_critical referenced in function __scrt_dllmain_uninitialize_critical
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_attach referenced in function __scrt_dllmain_crt_thread_attach
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_detach referenced in function __scrt_dllmain_crt_thread_detach
: warning LNK4088: image being generated due to /FORCE option; image may not run
msvcprt.lib(locale0_implib.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
This is certainly not a decant solution and is not guaranteed to be working in any case, however it worked for my codes at least.
I'm trying to build dll with static linking Poco library which require OpenSSl.
When I build Poco library with static linking with libeay32MDd.lib and ssleay32MDd.lib it works good but require OpenSSL's DLLs. If I use libeay32MTd.lib and ssleay32MTd.lib, it throws the following errors :
libeay32MTd.lib(e_capi.obj) : error LNK2019: unresolved external
symbol __imp_CertOpenStore referenced in function capi_open_store
8>libeay32MTd.lib(e_capi.obj) : error LNK2019: unresolved external
symbol __imp_CertCloseStore referenced in function capi_find_key
8>libeay32MTd.lib(e_capi.obj) : error LNK2019: unresolved external
symbol __imp_CertEnumCertificatesInStore referenced in function
capi_find_cert 8>libeay32MTd.lib(e_capi.obj) : error LNK2019:
unresolved external symbol __imp_CertFindCertificateInStore referenced
in function capi_find_cert 8>libeay32MTd.lib(e_capi.obj) : error
LNK2019: unresolved external symbol
__imp_CertDuplicateCertificateContext referenced in function capi_load_ssl_client_cert 8>libeay32MTd.lib(e_capi.obj) : error
LNK2019: unresolved external symbol __imp_CertFreeCertificateContext
referenced in function capi_find_key 8>libeay32MTd.lib(e_capi.obj) :
error LNK2019: unresolved external symbol
__imp_CertGetCertificateContextProperty referenced in function capi_cert_get_fname
you need to link with crypt32.lib
I downloaded the most recent Zeranoe dev build here, included the header files to my code, placed extern "C" around the includes, since this is a C++ project and FFmpeg is a C library, and added the libs to Visual Studio as well, and I get this linker error:
1>Camera.obj : error LNK2019: unresolved external symbol _av_free referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_freep referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_frame_alloc referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_frame_free referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_register_all referenced in function __catch$??0Camera#MicroDFV_Camera##QAE#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##0PAX#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_alloc_context3 referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_open2 referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_close referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_init_packet referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_packet_unref referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_find_encoder referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_encode_video2 referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_opt_set referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_image_alloc referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>M:\Desktop\OpenCVTest\Debug\OpenCVTest.exe : fatal error LNK1120: 14 unresolved externals
Searching here and on Google I found many recommendations, such as to add #pragma comment(lib,...), and that the libs are static, so their order is important, and none of this helps.
So I scratched my head even more and realized that the Zeranoe build is made with MinGW-w64, so probably it won't link with Visual Studio. I inspected the lib using dumpbin and the symbols on the libs don't have the underscore, so I am pretty sure it won't work.
The other Zeranoe builds for Windows don't have libs, they are just plain .exe or exe + .dll.
Will I have to make my own VS2013 build of FFmpeg to link it, or is there some alternative way?
I have downloaded EasyHook 2.7 source and I try to compile it in my Visual Studio 2012 environment.
After solving a lot of warnings, I have found other warnings that I cannot solve, and these are:
1>error.obj : error LNK2019: unresolved external symbol _CoTaskMemAlloc#4 referenced in function _RtlGetLastErrorStringCopy#0
1>error.obj : error LNK2019: unresolved external symbol _CopyMemory#12 referenced in function _RtlGetLastErrorStringCopy#0
1>reloc.obj : error LNK2019: unresolved external symbol _ud_init#4 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_set_mode#8 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_set_input_buffer#12 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_set_syntax#8 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_disassemble#4 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_translate_intel#4 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_set_asm_buffer#12 referenced in function _LhDisassembleInstruction#20
1>C:\Users\Jaime Stuardo\Downloads\EasyHook-2.7.5159.0-Source\\Debug\x86\EasyHook32Drv.sys : fatal error LNK1120: 9 unresolved externals
What lib files I need to add so that the linker will not fail? notice that the first 2 functions belong to Windows API, so it is very curious it does not link.
Regards
Jaime
For the Windows functions, just look them up on MSDN. CoTaskMemAlloc says you need to link OLE32.LIB. CopyMemory says KERNEL32.LIB. The functions beginning with ud come from a library which Easyhook depends on: "EasyHook makes use of the udis86 library by Vivek.