I patched ZLIB 1.2.11 using IPP 2016 (and 2019), all went fine, all compiled fine (using MSVC). But linker comes with following missing symbols (I added all necessary libs, and I actually tried adding all libs from IPP at all)
1>zlib_x32_debug.lib(deflate.obj) : error LNK2019: unresolved external symbol _ippsDeflateLZ77FastestGetStat_8u referenced in function _custDeflateUpdateTable
1>zlib_x32_debug.lib(deflate.obj) : error LNK2019: unresolved external symbol _ippsDeflateLZ77Fastest_8u referenced in function _lz77_encode_call
1>zlib_x32_debug.lib(deflate.obj) : error LNK2019: unresolved external symbol _ippsDeflateLZ77FastestPrecompHeader_8u referenced in function _lz77_encode_call
1>zlib_x32_debug.lib(deflate.obj) : error LNK2019: unresolved external symbol _ippsDeflateLZ77Fast_8u referenced in function _lz77_encode_call
1>zlib_x32_debug.lib(deflate.obj) : error LNK2019: unresolved external symbol _ippsDeflateLZ77Slow_8u referenced in function _lz77_encode_call
1>zlib_x32_debug.lib(deflate.obj) : error LNK2019: unresolved external symbol _ippsDeflateLZ77FastestGenHuffTable_8u referenced in function _zzdeflateGetTabLen
1>zlib_x32_debug.lib(deflate.obj) : error LNK2019: unresolved external symbol _ippsDeflateLZ77FastestGenHeader_8u referenced in function _zzdeflateGetTabLen
Then I even tried to search the libs for these symbols and they are nowhere to be found... Any ideas?
Please, check that you link proper IPP library bit version to your object files. I mean, 32-bit libraries should be linked to 32-bit object files. Looks, like "zlib_x32_debug.lib" is a 64-bit static lib (and linker looks for 64-bit variant of functions). As far as I remember, 32-bit functions have object files names like "blabla#number" and 64-bit functions are named as "_blabla".
Related
I have one project which uses libevent libraries and i am compiling it VS2017. It runs in linux perfectly. I am getting errors like below:
1>ftpcmd.obj : error LNK2019: unresolved external symbol evutil_snprintf referenced in function do_client_read
1>ftpcmd.obj : error LNK2019: unresolved external symbol evutil_inet_pton referenced in function handle_pasv
1>ftpdata.obj : error LNK2001: unresolved external symbol evutil_inet_pton
1>ftpcmd.obj : error LNK2019: unresolved external symbol bufferevent_free referenced in function fs_client_free
1>ftpdata.obj : error LNK2001: unresolved external symbol bufferevent_free
Does anyone know how to link libevent with project? I read some question related to that and they say i need to compile libevent using VS commad prompt. I tried that with nmake -f Makefile.nmake libevent-2.1.8-stable but it failed.
Thanks in advance.
I'm trying to build a simple command line application which uses WinUSB in Visual Studio 2013. I'm getting no compile errors, but lots of linker errors. The following are some of them:
winusblnk.obj : error LNK2019: unresolved external symbol imp__Sleep#4 referenced in function _msDelay
winusbnet.obj : error LNK2001: unresolved external symbol __imp__Sleep#4
What do the references to obj files mean? How do I see these OBJ files? How can I inspect them and see what functions they have inside them?
What does __imp__Sleep#4 mean? What do all the underscores mean? What does the #4 mean? How do I find the reference to this symbol?
What is the difference between error LNK2019 and error LINK2001?
There are lots more similar errors in winusbxxx.obj files.
errhnd.obj : error LNK2019: unresolved external symbol __imp__GetLocalTime#4 referenced in function _logerr
readtemp.obj : error LNK2019: unresolved external symbol _ReadTemperature referenced in function _main
Same questions.
MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp__IsDebuggerPresent#0 referenced in function ___raise_securityfailure
MSVCRTD.lib(error.obj) : error LNK2001: unresolved external symbol __imp__IsDebuggerPresent#0
How do I look at the contents of these lib files, and see which obj files they contain, and which functions each of those contain?
There are lots more errors in MSVCRTD.lib
I hope someone can give me some guidance on finding the cause of all these errors.
Thanks - Rowan
This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 8 years ago.
I'm trying to write a simple PNG file using libpng in C using VS2013. I installed libpng from Nuget and included png.h, but I can't compile. I get this as my output:
1>main.obj : error LNK2019: unresolved external symbol png_create_write_struct referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_set_longjmp_fn referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_create_info_struct referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_write_info referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_destroy_write_struct referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_init_io referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_free_data referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_set_IHDR referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_set_text referenced in function writeImage
I've tried playing with the compilation settings, but nothing seems to make it work. I don't get any red lines under any of those declarations when I write the code, so VS must be seeing some of the code.
Besides including png.h you must also link with the appropriate import library (probably called libpng.lib or something similar). In Visual Studio, you would add this to Project Settings → Linker → Input → Additional Dependencies.
I have compiled 32-bit dll library and I have its source and header file. The library is somehow showing print dialog and allows me to print files. I've made 32-bit C# application, which calls printing function in dll and everything is nice.
However, now I need to recompile library to 64-bit (Recompiling my C# project is easy). Basicly I tried two methods.
First one was compiling from Visual's Studio Developer command prompt. This was first time compiling something using command line, so I googled what should I write. I was not attempting to specify 64-bit architecture, because I wanted to be sure that it is working. I used this command to build it.
cl /D_USRDLL /D_WINDLL printing.c User32.Lib WinSpool.Lib Gdi32.Lib ComDlg32.Lib /link /DLL /OUT:printing.dll
It made printing.dll for me, I tried to replace precompiled version I already had and I tried it using my C# app. Everything worked. So I wanted to compile it as 64-bit library. I googled and found out, that I have to use different cl.exe and link.exe located in Program Files\Microsoft Visual Studio 12.0\VC\bin\amd64. So I cd-ed to correct folder and wrote same command. I've got bunch (29) of "unresolved externals", I googled and found out that it is because I am trying to link 32-bit libraries. So I changed all *.Lib-s to C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64*.Lib", retried and still got some (16) unresolved extarnals. Here is the list
/out:printing.exe
/DLL
/OUT:D:\Temp\printing\printing.dll
printing.obj
"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64\User32.Lib"
"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64\WinSpool.Lib"
"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64\Gdi32.Lib"
"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64\ComDlg32.Lib"
Creating library D:\Temp\printing\printing.lib and object D:\Temp\printing\printing.exp
printing.obj : error LNK2019: unresolved external symbol __report_rangecheckfailure referenced in function RSS_PrintFile
printing.obj : error LNK2019: unresolved external symbol strcpy referenced in function RSS_PrintFileBez
printing.obj : error LNK2019: unresolved external symbol strcmp referenced in function RSS_PrintFileBez
printing.obj : error LNK2019: unresolved external symbol strlen referenced in function RSS_PrintFile
printing.obj : error LNK2019: unresolved external symbol __imp_CreateFileA referenced in function RSS_PrintFile
printing.obj : error LNK2019: unresolved external symbol __imp_ReadFile referenced in function RSS_PrintFile
printing.obj : error LNK2019: unresolved external symbol __imp_CloseHandle referenced in function RSS_PrintFile
printing.obj : error LNK2019: unresolved external symbol __imp_GlobalFree referenced in function RSS_PrintFile
printing.obj : error LNK2019: unresolved external symbol __imp_LocalAlloc referenced in function RSS_PrintFileBez
printing.obj : error LNK2019: unresolved external symbol __imp_LocalHandle referenced in function RSS_PrintFileBez
printing.obj : error LNK2019: unresolved external symbol __imp_LocalFree referenced in function RSS_PrintFileBez
printing.obj : error LNK2019: unresolved external symbol atoi referenced in function RSS_PrintFileBezFromTo
printing.obj : error LNK2001: unresolved external symbol __GSHandlerCheck
printing.obj : error LNK2019: unresolved external symbol __security_check_cookie referenced in function RSS_PrintFile
printing.obj : error LNK2019: unresolved external symbol __security_cookie referenced in function RSS_PrintFile
LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup
D:\Temp\printing\printing.dll : fatal error LNK1120: 16 unresolved externals
I managed to get rid of 4 unresolved externals adding /GS- option to compiler, but I do not know how to fix rest and I could not find any help. So I decided to use Microsoft Visual Studio to build my libary.
I've created new C++ project, set it to be a DLL library, added source and header file, compiled (using standart settings, on 32-bit). I've got bunch of warnings like this one
'function' : incompatible types - from 'char *' to 'LPCWSTR'
and simmilars and one error
'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
So I #include _CRT_SECURE_NO_WARNINGS on first line of printing.c file. Hiting "Build" button then resulted in 1 successful and I got my printing.dll. I replaced printing.dll I've got from command line by this one and I tested dll using my C# app. Pressing print button brought "Select Printer and so" window (as before), but hitting print resulted in opening small window with some chinese text. However, I can easily build it as 64-bit.
I would like to ask what am I doing wrong, why I can not compile C library from command prompt and why Microsoft visual studio somehow makes DLL not working.
I tried to debug DLL library compiled using MVS, but I failed. I do not know which solution should I open (C# testing app, or C DLL solution) and what to do next. C# wont show me code from another solution and even if I up debuger in DLL solution to open C# application it produces error
Debugginng information for "app.exe" could not be found or does not match. Skipped loading symbols for NGen binary.
and even if I press "Continue debugging", any breakpoint says, that it wont be hit, because no symbols were loaded.
So Basicly
How do I get rid of "unresolved externals" errors while compiling as 64-bit using command line?
OR
How do I fix Microsoft Visual Studio to built working dll library (does not matter if 32-bit or 64bit)?
Ok. I've managed to fix this issue. I gave up trying to build 64-bit version using command line and focused on fixing issue about chinese chars. I went to Project -> Project Properties -> Configuration Properties -> C/C++ -> Command Line to see what compiler parameters are passed. Then I went back to command line, and added previously found parameters one by one and testing if dll works. When I added /D "UNICODE", the library stopped working.
This being said, adding #undef UNICODE or setting Configuration Properties -> General -> Project Defaults -> Character Set to Not Set fixed my issue and now I a able to compile my printing library for both x86 and x64 architectures.
I have a problem with linking a program, the strange thing about that is that functions that linker can't resolve, sit in the same file near the functions that are resolved without a problem.
I can't post files themselves in the message as they are pretty large, though ===> here <=== is the project ready to be built.
Here are build errors:
error LNK2019: unresolved external symbol _leveldb_filterpolicy_destroy referenced in function _main
error LNK2019: unresolved external symbol _leveldb_options_set_filter_policy referenced in function _main
error LNK2019: unresolved external symbol _leveldb_filterpolicy_create_bloom referenced in function _main
error LNK2019: unresolved external symbol _leveldb_filterpolicy_create referenced in function _main
error LNK2019: unresolved external symbol _leveldb_filterpolicy_create referenced in function _main
Here is the full-size screenshot showing error messages
Here is the implementation of the function that cant be found:
Here is the implementation of the function that sits in the same file and is easily found by the linker:
I've found-out what was causing the problem, I've updated the version of leveldb to a newer one. The newer version introduced several new functions (the ones that are being unresolved). But I haven't updated the .def file which contains all exports, and functions weren't exported as a result...