I'm using VS2015 Community. I have obtained some C code that I'm trying to build. It is all in C and I have made a project as a Console Application.
When I build I get the below errors. The problem is that __stdio_common_vsprintf_s cannot be found during the link process. So I searched the internet for the symbols but don't get any useful information.
I am using the Runtime Library setting called Multi-threaded (/MT).
I have tried adding #define STDC_WANT_LIB_EXT1 1 before all includes but that did not help. I have searched for this problem and have not found any postings that help.
So I searched all of the VS libraries and got lots of hits but I don't know which are definitions and which are references. Then I searched all of the .h files in the VS include folder but no hits.
I suspect there may be another library that I need but don't know what it is. Does anyone have any ideas?
1>LIBCMT.lib(_error_.obj) : error LNK2019: unresolved external symbol ___stdio_common_vsprintf_s referenced in function __vsprintf_s_l
1>LIBCMT.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol ___vcrt_GetModuleFileNameW referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)
1>LIBCMT.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol ___vcrt_LoadLibraryExW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDllFromInstallPath(void)" (?GetPdbDllFromInstallPath@@YAPAUHINSTANCE__@@XZ)
1>MSVCRTD.lib(_chandler4gs_.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4
1>W:\efifs\Debug\testing.exe : fatal error LNK1120: 6 unresolved externals
Here are my options:
Compile
----------
/GS
/analyze-
/W3
/Zc:wchar_t
/I"W:\efifs\\gnu-efi\inc"
/I"W:\efifs\\gnu-efi\inc\ia32"
/I"W:\efifs\\grub\include"
/I"W:\efifs\\grub-core\lib\minilzo"
/I"W:\efifs\testing\"
/I"W:\efifs\\gnu-efi\inc\protocol"
/I"W:\efifs\\gnu-efi\lib"
/I"W:\efifs\\include"
/I"W:\efifs\\grub\grub-core\lib\minilzo"
/I"W:\efifs\.msvc"
/ZI
/Gm
/Od
/Fd"Debug\vc140.pdb"
/Zc:inline
/fp:precise
/D "__STDC_WANT_LIB_EXT1__=1"
/D "_UNICODE"
/D "UNICODE"
/D "GRUB_FILE=__FILE__"
/D "HAVE_USE_MS_ABI"
/D "GNU_EFI_USE_EXTERNAL_STDARG"
/D "DRIVERNAME=testing"
/D "WIN32"
/D "_DEBUG"
/D "_CONSOLE"
/errorReport:prompt
/WX-
/Zc:forScope
/RTC1
/Gd
/Oy-
/MT
/Fa"Debug\"
/EHsc
/nologo
/Fo"Debug\"
/Fp"Debug\testing.pch"
Link
-----
/OUT:"W:\efifs\Debug\testing.exe"
/MANIFEST
/NXCOMPAT
/PDB:"W:\efifs\Debug\testing.pdb"
/DYNAMICBASE "efifs.lib" "grub.lib" "gnu-efi.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib"
/MACHINE:X86
/INCREMENTAL
/PGD:"W:\efifs\Debug\testing.pgd"
/SUBSYSTEM:CONSOLE
/MANIFESTUAC:"level='asInvoker' uiAccess='false'"
/ManifestFile:"Debug\testing.exe.intermediate.manifest"
/ERRORREPORT:PROMPT
/NOLOGO
/LIBPATH:"W:\efifs\testing\\grub"
/LIBPATH:"W:\efifs\testing\\efifs"
/LIBPATH:"W:\efifs\testing\\gnu-efi"
/TLBID:1
If you look how vsprintf is declared you can trace it corecrt_stdio ... where it says to inline it.
I had some old DLL which were linking against old msvcrt and trying to import vsprintf from it but seems like VS2015 have new headers and trying to inline it.
Setting _NO_CRT_STDIO_INLINE helped to resolve it, Enjoy.
Edit: Also https://msdn.microsoft.com/en-us/library/bb531344.aspx