How to resolve the following linker errors in Visual Studio? - visual-studio

Here is My scenario. I have a project which contains 30 subprojects. In one of the projects I have used CLR (common language runtime) so I modified its runtime with /mdd (multi threaded debug DLL).
Individually all the projects are built successfully. But when I try to compile the main
project I am getting the following linker errors:
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)
LIBCMTD.lib(fclose.obj) : error LNK2005: _fclose already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(printf.obj) : error LNK2005: _printf already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(mbstowcs.obj) : error LNK2005: _mbstowcs already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(wcstombs.obj) : error LNK2005: _wcstombs already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tzset.obj) : error LNK2005: __tzset already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(stricmp.obj) : error LNK2005: __stricmp already defined in MSVCRTD.lib(MSVCR80D.dll)
How to resolve these all?

LIBCMTD is the debug version of the static multi-threaded C runtime library. MSVCR80D is a debug version of the DLL-based multi-threaded C runtime library. Some of your sub-projects are calling for one, some the other. It's a Microsoft mess, but you have to deal with it. Pick one, say, Multi-threaded debug DLL, and use it exclusively for the Debug version of your project and all sub-projects. The Microsoft license (I am told) requires that you use a non-debug version for released software.
See the following for more info: CLICK.

Seems like some of your projects use static runtime library. (And you have chosen dynamic for one of your projects)
This combination is unsupported.
Reminds me of: Linker errors between multiple projects in Visual C++

Related

printf / _vsnprintf_l / already defined in msvcrtd.lib(MSVCR120D.dll)

I have project where I want to import library. When I do that (import .lib files from library) and than call any function from library I get following errors:
"C:\Uz\myproj.vcxproj" (default target) (1) ->(Link target) ->
aziotsharedutil.lib(consolelogger.obj) : error LNK2005: printf already defined in msvcrtd.lib(MSVCR120D.dll) [C:\Uz\myproj.vcxproj]
aziotsharedutil.lib(socketio_win32.obj) : error LNK2005: _vsnprintf_l already defined in msvcrtd.lib(MSVCR120D.dll) [C:\Uz\myproj.vcxproj]
uamqp.lib(amqpvalue_to_string.obj) : error LNK2005: _vsnprintf_l already defined in msvcrtd.lib(MSVCR120D.dll) [C:\Uz\myproj.vcxproj]
C:\Dz\myproj.vcxproj\myproj.dll : fatal error LNK1169: one or more multiply defined symbols found [C:\Uz\myproj.vcxproj]
0 Warning(s)
4 Error(s)
Does anyone know how can i fix this?
I have following libraries imported in my project:
msvcprtd.lib
msvcrtd.lib
kernel32.lib
ole32.lib
aziotsharedutil.lib //imported Library .lib file
uamqp.lib //imported Library .lib file
eventhub_client.lib //imported Library .lib file
Advapi32.lib
Crypt32.lib
Ws2_32.lib
Secur32.lib
ucrt.lib
vcruntime.lib
Note 1
All 3 projects that are built as Static Link Library .lib, have same settings Multi-threaded Debug DLL (/MDd), same as my project.
Thanks!
Compiled with same version of compiler and that solved my problem!

To build the program with a static lib, libcurl.lib

I tried to build a stanalone program with a static lib, libcurl.lib. But I got bunch of errors.
I ever refered to the related posts on stackoverflow and libcurl homepage, unfortunately it is in vain so far.
The following is my building procedure and the error message I got.
Please comments.
Thank you a lot,
1. Build curl from source code
nmake /f Makefile.vc mode=static VC=14 ENABLE_SSPI=no ENABLE_IPV6=no ENABLE_IDN=no GEN_PDB=no DEBUG=no MACHINE=x64
2. Build main.obj CimXml.obj CimCurl.obj getpass.obj
"cl -I.\include -DCURL_STATICLIB -EHsc -c main.cpp CimXml.cpp CimCurl.cpp getpass.cpp"
3. Build a "STATIC" library cimxml.lib
"lib CimXml.obj CimCurl.obj getpass.obj /out:cimxmlcurl.lib"
4. Build the alc.exe
"cl -DCURL_STATICLIB -I.\include main.obj cimxmlcurl.lib libcurl_a.lib /link /LIBPATH:.\lib /verbose:lib /out:alc.exe"
Error Message:
C:\Users\nick\Documents\sblim-wbemcli-1.6.3-Beta>cl -DCURL_STATICLIB -I.\include main.obj cimxmlcurl .lib libcurl_a.lib /link /LIBPATH:.\lib /verbose:lib /out:alc.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
/LIBPATH:.\lib
/nodefaultlib:MSVCRT.lib
/verbose:lib
/out:alc.exe
main.obj
cimxmlcurl.lib
libcurl_a.lib
Searching libraries
Searching cimxmlcurl.lib:
Searching .\lib\libcurl_a.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libcpmt.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\uuid.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64\libucrt.lib:
Searching cimxmlcurl.lib:
Searching .\lib\libcurl_a.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libcpmt.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\uuid.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
Finished searching libraries
Searching libraries
Searching cimxmlcurl.lib:
Searching .\lib\libcurl_a.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libcpmt.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\uuid.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64\libucrt.lib:
Finished searching libraries
libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol strdup imported in function curl_easy_init
OLDNAMES.lib(strdup.obi) : warning LNK4049: locally defined symbol strdup imported
libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol calloc imported in function curl_easy_init
libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol free imported in function curl_easy_init
libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol malloc imported in function curl_easy_init
libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol realloc imported in function curl_easy_init
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strrchr imported
libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol strrchr imported
libcurl_a.lib(strerror.obj) : warning LNK4217: locally defined symbol strrchr imported in function Curl_strerror
libcurl_a.lib(cookie.obj) : warning LNK4049: locally defined symbol strrchr imported
libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol strrchr imported
libcurl_a.lib(transfer.obj) : warning LNK4049: locally defined symbol strrchr imported
libcurl_a.lib(strerror.obj) : warning LNK4217: locally defined symbol strerror imported in function Curl_strerror
libcurl_a.lib(strerror.obj) : warning LNK4217: locally defined symbol strncpy imported in function Curl_strerror
libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol strncpy imported
libcurl_a.lib(telnet.obj) : warning LNK4049: locally defined symbol strncpy imported
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strncpy imported
libcurl_a.lib(strerror.obj) : warning LNK4217: locally defined symbol __sys_nerr imported in function Curl_strerror
libcurl_a.lib(pingpong.obj) : warning LNK4049: locally defined symbol memmove imported
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol memmove imported in function sanitize_cookie_path
libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol memmove imported
libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol memmove imported
libcurl_a.lib(imap.obj) : warning LNK4049: locally defined symbol memmove imported
libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol strchr imported in function Curl_ftp_parselist
libcurl_a.lib(curl_ntlm_msgs.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(http_digest.obj) : warning LNK4217: locally defined symbol strchr imported in function Curl_output_digest
libcurl_a.lib(dotdot.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(curl_gethostname.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(ldap.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(file.obj) : warning LNK4217: locally defined symbol strchr imported in function file_do
libcurl_a.lib(smb.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(pipeline.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(strtok.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(inet_pton.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(dict.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol strchr imported in function Curl_cookie_add
libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol strchr imported
libcurl_a.lib(transfer.obj) : warning LNK4217: locally defined symbol strchr imported in function _vsscanf_l
libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol strncmp imported
libcurl_a.lib(rtsp.obj) : warning LNK4217: locally defined symbol strncmp imported in function rtsp_do
libcurl_a.lib(dotdot.obj) : warning LNK4217: locally defined symbol strncmp imported in function Curl_dedotdotify
libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol strncmp imported in function Curl_ftp_parselist
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol strncmp imported in function Curl_cookie_add
libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol strncmp imported
libcurl_a.lib(connect.obj) : warning LNK4217: locally defined symbol strncmp imported in function Curl_sndbufset
libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol strncmp imported in function curl_mprintf
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol __acrt_iob_func imported in function Curl_cookie_init
libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol __acrt_iob_func imported
libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol __acrt_iob_func imported in function _vsnprintf_l
libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol __acrt_iob_func imported
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol fclose imported in function Curl_cookie_init
libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol fclose imported
libcurl_a.lib(netrc.obj) : warning LNK4049: locally defined symbol fclose imported
libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol fclose imported
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol fgets imported in function Curl_cookie_init
libcurl_a.lib(netrc.obj) : warning LNK4049: locally defined symbol fgets imported
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol fopen imported in function Curl_cookie_init
libcurl_a.lib(netrc.obj) : warning LNK4049: locally defined symbol fopen imported
libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol fopen imported
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
libcurl_a.lib(rtsp.obj) : warning LNK4217: locally defined symbol __stdio_common_vsscanf imported in function rtsp_do
libcurl_a.lib(socks.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
libcurl_a.lib(http_proxy.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
libcurl_a.lib(transfer.obj) : warning LNK4217: locally defined symbol __stdio_common_vsscanf imported in function readwrite_data
libcurl_a.lib(parsedate.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
libcurl_a.lib(telnet.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
libcurl_a.lib(imap.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol __stdio_common_vsscanf imported in function _vsscanf_l
libcurl_a.lib(hostip.obj) : warning LNK4217: locally defined symbol __stdio_common_vsscanf imported in function Curl_global_host_cache_init
libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol qsort imported in function Curl_cookie_getlist
libcurl_a.lib(file.obj) : warning LNK4049: locally defined symbol strtoll imported
libcurl_a.lib(http_proxy.obj) : warning LNK4049: locally defined symbol strtoll imported
libcurl_a.lib(http_chunks.obj) : warning LNK4217: locally defined symbol strtoll imported in function Curl_chunked_strerror
libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol strtoll imported in function Curl_ftp_parselist
libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol strtoll imported in function Curl_cookie_add
libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol strtoll imported
libcurl_a.lib(imap.obj) : warning LNK4049: locally defined symbol strtoll imported
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strtoll imported
libcurl_a.lib(asyn-thread.obj) : warning LNK4217: locally defined symbol _errno imported in function init_resolve_thread
libcurl_a.lib(http_chunks.obj) : warning LNK4049: locally defined symbol _errno imported
libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol _errno imported in function Curl_ftp_parselist
libcurl_a.lib(hostip.obj) : warning LNK4217: locally defined symbol tolower imported in function Curl_cache_addr
libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol tolower imported
libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol isalpha imported in function parse_proxy
libcurl_a.lib(parsedate.obj) : warning LNK4049: locally defined symbol isalpha imported
libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isalpha imported
libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol isxdigit imported in function parse_proxy
libcurl_a.lib(escape.obj) : warning LNK4049: locally defined symbol isxdigit imported
libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isxdigit imported
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strstr imported
libcurl_a.lib(curl_sasl.obj) : warning LNK4217: locally defined symbol strstr imported in function Curl_sasl_continue
libcurl_a.lib(ftplistparser.obj) : warning LNK4049: locally defined symbol strstr imported
libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol strstr imported in function parse_proxy
libcurl_a.lib(http.obj) : warning LNK4217: locally defined symbol strstr imported in function Curl_http_readwrite_headers
libcurl_a.lib(transfer.obj) : warning LNK4049: locally defined symbol strstr imported
libcurl_a.lib(tftp.obj) : warning LNK4049: locally defined symbol strstr imported
libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol strpbrk imported in function parseurlandfillconn
libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol fwrite imported in function Curl_init_userdefined
libcurl_a.lib(sendf.obj) : warning LNK4049: locally defined symbol fwrite imported
libcurl_a.lib(tftp.obj) : warning LNK4049: locally defined symbol strtol imported
libcurl_a.lib(smtp.obj) : warning LNK4049: locally defined symbol strtol imported
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strtol imported
libcurl_a.lib(ftplistparser.obj) : warning LNK4049: locally defined symbol strtol imported
libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol strtol imported in function parse_proxy
libcurl_a.lib(mprintf.obj) : warning LNK4049: locally defined symbol strtol imported
libcurl_a.lib(pipeline.obj) : warning LNK4217: locally defined symbol strtol imported in function Curl_pipeline_penalized
libcurl_a.lib(parsedate.obj) : warning LNK4049: locally defined symbol strtol imported
libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol strtoul imported in function parseurlandfillconn
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strtoul imported
libcurl_a.lib(escape.obj) : warning LNK4049: locally defined symbol strtoul imported
libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isdigit imported
libcurl_a.lib(smtp.obj) : warning LNK4049: locally defined symbol isdigit imported
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol isdigit imported
libcurl_a.lib(curl_sasl.obj) : warning LNK4049: locally defined symbol isdigit imported
libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol isdigit imported in function Curl_ftp_parselist
libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol isdigit imported in function dprintf_DollarString
libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol isdigit imported
libcurl_a.lib(parsedate.obj) : warning LNK4049: locally defined symbol isdigit imported
libcurl_a.lib(imap.obj) : warning LNK4049: locally defined symbol isdigit imported
libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol fputc imported in function curl_mfprintf
libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol __stdio_common_vsprintf imported in function _vsnprintf_l
libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isspace imported
libcurl_a.lib(http_digest.obj) : warning LNK4049: locally defined symbol isspace imported
libcurl_a.lib(curl_ntlm.obj) : warning LNK4049: locally defined symbol isspace imported
libcurl_a.lib(curl_sasl.obj) : warning LNK4217: locally defined symbol isspace imported in function Curl_sasl_continue
libcurl_a.lib(ftplistparser.obj) : warning LNK4049: locally defined symbol isspace imported
libcurl_a.lib(http.obj) : warning LNK4217: locally defined symbol isspace imported in function Curl_add_custom_headers
libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol isspace imported
libcurl_a.lib(file.obj) : warning LNK4049: locally defined symbol isspace imported
libcurl_a.lib(rtsp.obj) : warning LNK4049: locally defined symbol isspace imported
libcurl_a.lib(http.obj) : warning LNK4217: locally defined symbol memchr imported in function Curl_http_readwrite_headers
libcurl_a.lib(tftp.obj) : warning LNK4217: locally defined symbol memchr imported in function tftp_connect
libcurl_a.lib(transfer.obj) : warning LNK4217: locally defined symbol fseek imported in function Curl_readrewind
libcurl_a.lib(progress.obj) : warning LNK4217: locally defined symbol fflush imported in function Curl_pgrsUpdate
libcurl_a.lib(strequal.obj) : warning LNK4217: locally defined symbol stricmp imported in function curl_strequal
OLDNAMES.lib(stricmp.obi) : warning LNK4049: locally defined symbol stricmp imported
libcurl_a.lib(strequal.obj) : warning LNK4217: locally defined symbol strnicmp imported in function curl_strnequal
OLDNAMES.lib(strnicmp.obi) : warning LNK4049: locally defined symbol strnicmp imported
libcurl_a.lib(parsedate.obj) : warning LNK4217: locally defined symbol isalnum imported in function parsedate
libcurl_a.lib(rtsp.obj) : warning LNK4049: locally defined symbol isalnum imported
libcurl_a.lib(ftplistparser.obj) : warning LNK4049: locally defined symbol isalnum imported
libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isalnum imported
libcurl_a.lib(telnet.obj) : warning LNK4217: locally defined symbol atoi imported in function check_telnet_options
libcurl_a.lib(file.obj) : warning LNK4217: locally defined symbol _lseeki64 imported in function file_do
libcurl_a.lib(getenv.obj) : warning LNK4217: locally defined symbol getenv imported in function GetEnv
libcurl_a.lib(curl_sasl.obj) : warning LNK4217: locally defined symbol isupper imported in function Curl_sasl_decode_mech
libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isupper imported
libcurl_a.lib(curl_ntlm_core.obj) : warning LNK4217: locally defined symbol toupper imported in function Curl_ntlm_core_mk_ntlmv2_hash
libcurl_a.lib(curl_fnmatch.obj) : warning LNK4217: locally defined symbol islower imported in function loop
libcurl_a.lib(curl_fnmatch.obj) : warning LNK4217: locally defined symbol isprint imported in function loop
libcurl_a.lib(curl_fnmatch.obj) : warning LNK4217: locally defined symbol isgraph imported in function loop
OLDNAMES.lib(strdup.obi) : warning LNK4049: locally defined symbol _strdup imported
OLDNAMES.lib(read.obi) : warning LNK4049: locally defined symbol _read imported
OLDNAMES.lib(write.obi) : warning LNK4049: locally defined symbol _write imported
OLDNAMES.lib(stricmp.obi) : warning LNK4049: locally defined symbol _stricmp imported
OLDNAMES.lib(strnicmp.obi) : warning LNK4049: locally defined symbol _strnicmp imported
OLDNAMES.lib(close.obi) : warning LNK4049: locally defined symbol _close imported
OLDNAMES.lib(open.obi) : warning LNK4049: locally defined symbol _open imported
libcurl_a.lib(cookie.obj) : error LNK2019: unresolved external symbol __imp_fputs referenced in function cookie_output
libcurl_a.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp__time64
libcurl_a.lib(curl_ntlm_core.obj) : error LNK2001: unresolved external symbol __imp__time64
libcurl_a.lib(cookie.obj) : error LNK2001: unresolved external symbol __imp__time64
libcurl_a.lib(hostip.obj) : error LNK2001: unresolved external symbol __imp__time64
libcurl_a.lib(http.obj) : error LNK2001: unresolved external symbol __imp__time64
libcurl_a.lib(tftp.obj) : error LNK2001: unresolved external symbol __imp__time64
libcurl_a.lib(url.obj) : error LNK2019: unresolved external symbol __imp_fread referenced in function Curl_init_userdefined
libcurl_a.lib(transfer.obj) : error LNK2001: unresolved external symbol __imp_fread
libcurl_a.lib(formdata.obj) : error LNK2001: unresolved external symbol __imp_fread
libcurl_a.lib(warnless.obj) : error LNK2019: unresolved external symbol __imp_read referenced in function curlx_read
OLDNAMES.lib(read.obi) : error LNK2001: unresolved external symbol __imp_read
libcurl_a.lib(warnless.obj) : error LNK2019: unresolved external symbol __imp_write referenced in function curlx_write
OLDNAMES.lib(write.obi) : error LNK2001: unresolved external symbol __imp_write
libcurl_a.lib(parsedate.obj) : error LNK2019: unresolved external symbol __imp__gmtime64 referenced in function Curl_gmtime
libcurl_a.lib(curl_threads.obj) : error LNK2019: unresolved external symbol __imp__beginthreadex referenced in function Curl_thread_create
libcurl_a.lib(file.obj) : error LNK2019: unresolved external symbol __imp_close referenced in function file_done
OLDNAMES.lib(close.obi) : error LNK2001: unresolved external symbol __imp_close
libcurl_a.lib(file.obj) : error LNK2019: unresolved external symbol __imp_open referenced in function file_connect
OLDNAMES.lib(open.obi) : error LNK2001: unresolved external symbol __imp_open
libcurl_a.lib(file.obj) : error LNK2019: unresolved external symbol __imp__fstat64 referenced in function file_do
libcurl_a.lib(smb.obj) : error LNK2019: unresolved external symbol __imp__getpid referenced in function smb_format_message
libcurl_a.lib(formdata.obj) : error LNK2019: unresolved external symbol __imp__stat64 referenced infunction AddFormData
alc.exe : fatal error LNK1120: 12 unresolved externals
I figure it out finally.
I have to use:
"nmake RTLIBCFG=static /f Makefile.vc mode=static VC=14
ENABLE_IPV6=no ENABLE_IDN=no GEN_PDB=no DEBUG=no MACHINE=x64" in the
first step
and to
compile with /MT option for every steps using "cl.exe" like Hans
Passant commented.
Hopefully, this can help out people suffering in the same issue.
Bby the way, I found a the website with similar solution as below, http://www.chipkin.com/building-libcurl-on-windows-with-mt-and-mtd/.

getting nafxcwd.lib(timecore.obj) error lnk2001 unresolved external symbol __mbctype after header-include from other project

I made a new project for unittesting with googleTest. I then added a source file from another project to test it. I then got severeal linker errors:
nafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
The key options in my projects are:
Testproject:
Runtime Library: Multithreaded Debug DLL (necessary for googleTest)
Use of MFC: Shared DLL
productive project: (this should actually not matter)
Runtime Library: Multithreaded Debug DLL
Use of MFC: Use MFC in a static library
Even if I copy all the options and files from the productive project with MFC as shared DLL these messages get thrown.
The file, that was imported to the testproject had the "stdafx.h"-include that was resolved to the productive projects one.
There,
#include <afxwin.h>
was included. Checking that one turned out, that for shared MFC-DLL, you need to
#define _AFXDLL
in your project / before the afxwin-include. Otherwise you get these errors.

my vcproj does not comiple when added in another sln (already containing some other project)

I have pangoft2.vcproj. Once I have set the include directories etc., it compiles successfully.
Now, in a new .sln (where I have a pango.vcproj), I add this pangoft2.vcproj. Now, when I compile the program, it gives 474 errors.
I have copied a few lines here:
Error 20 error LNK2001: unresolved external symbol __imp_g_utf8_skip thai-shaper.obj
Error 47 error LNK2001: unresolved external symbol g_utf8_get_char thai-shaper.obj
Error 121 error LNK2001: unresolved external symbol pango_glyph_string_set_size thai-shaper.obj
Error 130 error LNK2001: unresolved external symbol pango_font_get_glyph_extents thai-shaper.obj
I must tell you that I have included the required libraries (pango-1.0.lib and glib-2.0.lib) in the project.
Can you tell me the possible reason of this error and how to over come it ?
Thanks in advance.
Resolved the error.
The project was in the Debug x64 mode, when I should have used debug win32 mode.

linking to a static 0MQ library in VS

This may be a Visual Studio question more than anything else...
I'm trying to build a 0MQ C++ example using VS10 and ZeroMQ 2.2.0.
I downloaded the windows sources and tried to follow these instructions in order to build 0MQ statically. Specifically:
Switched to Release
For all 7 projects in the solution:
set General\Configuration Type to Static library (.lib)
set C/C++\Code Generation\Runtime Library to Multi-threaded (/MT)
added ZMQ_STATIC to C/C++\Preprocessor\Preprocessor Definitions
Updated zmq.h and zmq_utils.h so that if _MSC_VER and ZMQ_STATIC are defined then DLL_EXPORT will also be defined
At this point 0MQ seems to build well.
Created an empty console project:
switched to Release
added a single cpp file with the example linked above
changed random to rand, srandom to srand and snprintf to _snprintf
set C/C++\Code Generation\Runtime Library to Multi-threaded (/MT)
added ...\zeromq-2.2.0\include folder to C/C++\General\Additional Include Directories
added ...\zeromq-2.2.0\builds\msvc\Release\*.lib to Linker\Input\Additional Dependencies
However I still receive the following linking errors:
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_bind
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_close
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_errno
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_init
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_msg_data
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_strerror
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_socket
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_msg_init_size
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_term
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_msg_close
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_send
What have I missed?
You should add ZMQ_STATIC to C/C++\Preprocessor\Preprocessor Definitions in your "empty console project" too. Otherwise, when you compile your application, ZMQ_EXPORT in zmq.h is defined as __declspec(dllimport), and as a result, MSVC looks for __imp__zmq_* symbols instead of zmq_*
I had similar errors - not when trying to statically link, but just trying to create a ZMQ project and link the .lib 'stubs' for the dll.
In my case it was because I was trying to link the 64-bit libraries into a 32-bit project. I had downloaded the wrong version. When I got the right ones, ie x86 instead of x64, it worked.
Is the static linking very important to you? If not, you can try out the second answer by elnino_9 here. Elaborating elnino_9's answer:
Download the sources and unzip to some local folder (say C:\dev\zeromq).
Go to C:\dev\zeromq-2.2.0\builds\msvc and open the msvc.sln solution. MS2010 will upgrade from a VS2008 to a VS2010 project
Build all of the projects.
The build should generate the two following files:
C:\dev\zeromq\lib\libzmq.lib - this is what you will need to reference in your project's linker options
C:\dev\zeromq_boaz\builds\msvc\Release\libzmq.dll - this you will need to copy to the same folder as your project's executable in order to run it (if your build was configured to 'Debug', the path would be C:\dev\zeromq\builds\msvc\ Debug \libzmq.dll)
Create your solution and project. Do the following:
In the Solution Explorer, right-click on you project, and select 'Properties' (at the very bottom).
Navigate to 'C/C++ --> General --> Additional Include Directories' and add C:\dev\zeromq\include. This will reference 0MQ's header files.
Navigate to 'Linker --> Input --> Additional Dependencies' and add the full path to the 'libzmq.dll' file from the previous step.
Build your project - this should go without errors now.
Copy 'libzmq.dll' to the same folder as your executable - your project should now run.
Some comments:
I am not sure why you need to reference the 'libzmq.lib' file. It is not needed by the executable (you can delete it, and it will still run, as the necessary logic resides in the dll). Can someone explain this?
Notice one caveat in the example for Windows users - the second binding statement (publisher.bind("ipc://weather.ipc");) will cause an exception. As explained here (though in fine-print), the Inter-Process Transport is not supported on Windows.
EDIT
I think the answer to my first comment can be found in MSDN:
"When the source code for the calling executable is compiled or assembled, the DLL function call generates an external function reference in the object code. To resolve this external reference, the application must link with the import library (.lib file) provided by the maker of the DLL."

Resources