unresolved external symbol __imp__scanf referenced in function _main - c

I compile a driver with visual studio 2008 and I get this error:
unresolved external symbol __imp__scanf referenced in function _main
I don't use any lib and the main function look like this:
__cdecl main {
.....
scanf(...);
}
Note: I have other errors with other native functions such as:
unresolved external symbol __imp__printf referenced in function _main
unresolved external symbol __imp__GetLastError#0 referenced in function _main
unresolved external symbol __imp__CreateFileA#28 referenced in function _main
...
The discussion here is not like my problem
Update:
I'm compiling a driver with WinDDK, I have pute the line in the sources file:
TARGETLIBS= $(SDK_LIB_PATH)\kernel32.lib
and much errors begin with unresolved external symbol __imp__ are clean except those: __scanf and _printf. So what lib I must add to fixe them?
Thanks

Related

unresolved external symbol from curl, although it's listed in external dependencies

I am getting the following error when building my project:
Error LNK2019 unresolved external symbol __imp_curl_global_init referenced in function twilio_send_message test_plugin C:\Dev\ts3Plugin-ExtendedPoke\pluginsdk\src\twilio.obj 1
Error LNK2019 unresolved external symbol __imp_curl_easy_strerror referenced in function twilio_send_message test_plugin C:\Dev\ts3Plugin-ExtendedPoke\pluginsdk\src\twilio.obj 1
Error LNK2019 unresolved external symbol __imp_curl_easy_init referenced in function twilio_send_message test_plugin C:\Dev\ts3Plugin-ExtendedPoke\pluginsdk\src\twilio.obj 1
Error LNK2019 unresolved external symbol __imp_curl_easy_setopt referenced in function twilio_send_message test_plugin C:\Dev\ts3Plugin-ExtendedPoke\pluginsdk\src\twilio.obj 1
Error LNK2019 unresolved external symbol __imp_curl_easy_perform referenced in function twilio_send_message test_plugin C:\Dev\ts3Plugin-ExtendedPoke\pluginsdk\src\twilio.obj 1
Error LNK2019 unresolved external symbol __imp_curl_easy_cleanup referenced in function twilio_send_message test_plugin C:\Dev\ts3Plugin-ExtendedPoke\pluginsdk\src\twilio.obj 1
Error LNK2019 unresolved external symbol __imp_curl_easy_getinfo referenced in function twilio_send_message test_plugin C:\Dev\ts3Plugin-ExtendedPoke\pluginsdk\src\twilio.obj 1
I have read many threads about similar problems, but I was not able to fix mine.
What makes me wondering about this error is, that all functions in the error messages are listed in their external dependencie header.
And when I jump into the function (for example "curl_global_init") it redicrects me into the right header listed under external dependencies. So there definitly is some linking.
Im not sure what the "__imp" before the function name in the error message means. How can i resolve this error?
Any help is appreciated :)
These are my includes in the twilio.c file
#include <string.h>
#include <C:\Program Files/Curl/curl.h>
#include "twilio.h"
If you use a static library, you need to define CURL_STATICLIB:
#define CURL_STATICLIB
#include <C:\Program Files/Curl/curl.h>

IPP patched ZLIB missing symbols

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".

Understanding VSC++ linker errors

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

Visual Studio 2013 and libpng [duplicate]

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.

C linker behaves strange gives unresolved externals where it shouldn't

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...

Resources