0

I am trying build my application but getting error _printf , _sscanf etc unresolved external symbols. I am linking CRT libcurtl.lib still compiler cries for unresolved external symbols

Ayush Gupta
  • 77
  • 10
  • about this cries not compiler but linker. you need simply search for `_printf`, `_sscanf` in lib files - look which containing this symbols (case sensetive) – RbMm Jan 02 '18 at 13:02

1 Answers1

1

from https://msdn.microsoft.com/en-us/library/bb531344.aspx

The printf and scanf family of functions are now defined inline. The definitions of all of the printf and scanf functions have been moved inline into <stdio.h>, <conio.h>, and other CRT headers. This is a breaking change that leads to a linker error (LNK2019, unresolved external symbol) for any programs that declared these functions locally without including the appropriate CRT headers. If possible, you should update the code to include the CRT headers (that is, add #include <stdio.h>) and the inline functions, but if you do not want to modify your code to include these header files, an alternative solution is to add an additional library to your linker input, legacy_stdio_definitions.lib.

so most simply solution - include legacy_stdio_definitions.lib to linker input

RbMm
  • 31,280
  • 3
  • 35
  • 56
  • error LNK2019: unresolved external symbol ___iob_func referenced in function _PrintMessage error LNK2001: unresolved external symbol ___iob_func can you suggest some solution for this? – Ayush Gupta Jan 03 '18 at 05:05
  • @AyushGupta - solution is very simply - you need search `*.lib` files which containing `___iob_func` (case sensitive). simply binary search. i for example found it *ntstc_msvcrt.lib* and *ntstc_libcmt.lib* from sdk/wdk folder. you can use it. also look like you use old code, old crt headers, but try use more new crt libs. in old crt libs (*msvcrt*, *libcmt* ) exist `___iob_func` but in modern libs - no. look for [this](https://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2) – RbMm Jan 03 '18 at 08:56