eiffel c compilation failure: error LNK2001: unresolved external symbol - c

I'm trying to get familiar with Eiffel language so I've installed Eiffel Studio 18 and created a Graphics application. Compilation failed with message:
Preparing C compilation using already configured msc C compiler...
ERROR: Cannot start "nmake".ERROR: Cannot start "nmake".
Documentation suggested that espawn utility may show available toolchains, however it seems to crash:
PS C:\Program Files\Eiffel Software\EiffelStudio 18.07 GPL\tools\spec\win64\bin> & "C:\Program Files\Eiffel Software\EiffelStudio 18.07 GPL\tools\spec\win64\bin\espawn.exe" -l
Eiffel Environment Command Spawn Utility - Version: 18.07
Copyright Eiffel Software 1985-2018. All Rights Reserved.
Available C/C++ compilers:
espawn: system execution failed.
Following is the set of recorded exceptions:
******************************** Thread exception *****************************
In thread Root thread 0x0 (thread id)
*******************************************************************************
-------------------------------------------------------------------------------
Class / Object Routine Nature of exception Effect
-------------------------------------------------------------------------------
APPLICATION root's creation Segmentation violation:
<000000000363C588> Operating system signal. Exit
-------------------------------------------------------------------------------
APPLICATION root's creation
<000000000363C588> Routine failure. Exit
-------------------------------------------------------------------------------
Unfortunately I couldn't find any toolchain related stuff except for that espawn util so I've tried to launch Eiffel Studio from VS development command prompt hoping that it may implicitly rely on some environment variables. This indeed helped, however compilation still fails with linker error:
Preparing C compilation using already configured msc C compiler...
big_file_C28_c.c
eoption.c
big_file_E2_c.c
big_file_C26_c.c
big_file_C27_c.c
big_file_C30_c.c
big_file_C29_c.c
big_file_C31_c.c
eref.c
epoly.c
esize.c
big_file_C25_c.c
big_file_C24_c.c
big_file_C23_c.c
big_file_C22_c.c
big_file_C21_c.c
big_file_C20_c.c
big_file_C19_c.c
eplug.c
eskelet.c
enames.c
evisib.c
big_file_C18_c.c
big_file_C17_c.c
big_file_C16_c.c
big_file_C15_c.c
big_file_C13_c.c
big_file_C14_c.c
ececil.c
big_file_C12_c.c
einit.c
eparents.c
big_file_C11_c.c
big_file_C10_c.c
big_file_C9_c.c
big_file_C8_c.c
big_file_C7_c.c
big_file_C6_c.c
big_file_C5_c.c
big_file_C4_c.c
big_file_C3_c.c
big_file_C2_c.c
big_file_C1_c.c
Скопировано файлов: 1.
emain.c
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.16.27024.1
Copyright (C) Microsoft Corporation. All rights reserved.
-STACK:5000000 -NODEFAULTLIB:libc -STACK:5000000 -NODEFAULTLIB:libc -SUBSYSTEM:WINDOWS -OUT:my_wel_application_1.exe
e1\emain.obj
"C:\Program Files\Eiffel Software\EiffelStudio 18.07 GPL\studio\spec\win64\lib\msc\finalized.lib" "C:\Program Files\Eiffel Software\EiffelStudio 18.07 GPL\library\wel\spec\msc\win64\lib\wel.lib"
USER32.lib WS2_32.lib ADVAPI32.lib GDI32.lib SHELL32.lib MSIMG32.lib COMDLG32.lib UUID.lib OLE32.lib OLEAUT32.lib COMCTL32.lib MPR.LIB SHLWAPI.LIB WINSPOOL.LIB
my_wel_application_1.res
E2\Eobj2.lib E1\eparents.obj E1\einit.obj E1\ececil.obj E1\evisib.obj
E1\enames.obj E1\eskelet.obj E1\eplug.obj E1\esize.obj E1\epoly.obj
E1\eref.obj E1\eoption.obj C31\Cobj31.lib C30\Cobj30.lib C29\Cobj29.lib
C28\Cobj28.lib C27\Cobj27.lib C26\Cobj26.lib C25\Cobj25.lib C24\Cobj24.lib
C23\Cobj23.lib C22\Cobj22.lib C21\Cobj21.lib C20\Cobj20.lib C19\Cobj19.lib
C18\Cobj18.lib C17\Cobj17.lib C16\Cobj16.lib C15\Cobj15.lib C14\Cobj14.lib
C13\Cobj13.lib C12\Cobj12.lib C11\Cobj11.lib C10\Cobj10.lib C9\Cobj9.lib
C8\Cobj8.lib C7\Cobj7.lib C6\Cobj6.lib C5\Cobj5.lib C4\Cobj4.lib
C3\Cobj3.lib C2\Cobj2.lib C1\Cobj1.lib
finalized.lib(econsole.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(console.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(file.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(main.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(except.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(sig.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(option.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(main.obj) : error LNK2019: unresolved external symbol _set_output_format referenced in function eif_rtinit
finalized.lib(run_idr.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(except.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(out.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(file.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(store.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(econsole.obj) : error LNK2019: unresolved external symbol vfprintf referenced in function print_err_msg
finalized.lib(file.obj) : error LNK2019: unresolved external symbol fscanf referenced in function rt_swallow_nl
finalized.lib(retrieve.obj) : error LNK2019: unresolved external symbol sscanf referenced in function iread_header_new
finalized.lib(run_idr.obj) : error LNK2001: unresolved external symbol sscanf
my_wel_application_1.exe : fatal error LNK1120: 6 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.EXE"' : return code '0x460'
Stop.

The compilation error when running from VS development command prompt is related to the mismatch between C compiler version and used Eiffel run-time library. Setting the corresponding environment variable before launching the compilation should fix the issue:
set ISE_C_COMPILER=msc_vc140
As to the original error, for some reason, C compilation fails on some machines, because EiffelStudio cannot find VS. The issue has even become a FAQ.

Related

Flite text-to-speech program with MSVC - Unresolved external symbols

I'm trying to use MSVC to compile a C program with the Flite text-to-speech library, but I'm getting unresolved external symbol errors.
I started with the "C Example" from the Flite docs but they use gcc. I was able to get rid of some errors by linking ws2_32.lib and legacy_stdio_definitions.lib but I can't find a solution to the remaining ones.
Do I just need to use a different compiler, or is there some solution that will allow me to use MSVC?
main.c
#include "flite.h"
register_cmu_us_kal();
int main(int argc, char **argv)
{
cst_voice *v;
if (argc != 2)
{
fprintf(stderr, "usage: flite_test FILE\n");
exit(-1);
}
flite_init();
v = register_cmu_us_kal(NULL);
flite_file_to_speech(argv[1], v, "play");
}
build.bat
cl ..\src\main.c -I "../lib/Flite/include/" /link ws2_32.lib legacy_stdio_definitions.lib /LIBPATH:"../lib/Flite/lib" libflite_cmu_us_kal.a libflite_usenglish.a libflite_cmulex.a libflite.a
Result
build.bat
Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26128 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
..\src\main.c(17): warning C4047: '=': 'cst_voice *' differs in levels of indirection from 'int'
Microsoft (R) Incremental Linker Version 14.13.26128.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
ws2_32.lib
legacy_stdio_definitions.lib
/LIBPATH:../lib/Flite/lib
libflite_cmu_us_kal.a
libflite_usenglish.a
libflite_cmulex.a
libflite.a
main.obj
libflite_usenglish.a(us_expand.o) : error LNK2019: unresolved external symbol __locale_ctype_ptr referenced in function en_exp_letters
libflite.a(cst_string.o) : error LNK2001: unresolved external symbol __locale_ctype_ptr
libflite.a(regexp.o) : error LNK2001: unresolved external symbol __locale_ctype_ptr
libflite.a(cst_lexicon.o) : error LNK2019: unresolved external symbol __getreent referenced in function cst_lex_make_entry
libflite.a(cst_error.o) : error LNK2001: unresolved external symbol __getreent
libflite.a(cst_tokenstream.o) : error LNK2001: unresolved external symbol __getreent
libflite.a(cst_mmap_posix.o) : error LNK2019: unresolved external symbol getpagesize referenced in function cst_mmap_file
libflite.a(cst_mmap_posix.o) : error LNK2019: unresolved external symbol mmap referenced in function cst_mmap_file
libflite.a(cst_mmap_posix.o) : error LNK2019: unresolved external symbol munmap referenced in function cst_munmap_file
libflite.a(au_oss.o) : error LNK2019: unresolved external symbol ioctl referenced in function audio_open_oss
main.exe : fatal error LNK1120: 6 unresolved externals

Linker error while building libevent project

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.

Fatal error LNK1120 when compiling c project

I tried to compile main.c from this project Emacs-FullScreen-Win32 by using visual studio developer command prompt but I get the following error:
main.c
Microsoft (R) Incremental Linker Version 11.00.60610.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
main.obj : error LNK2019: unresolved external symbol __imp__ShowWindowAsync#8 re
ferenced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__SetWindowPos#28 refe
renced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__MessageBoxW#16 refer
enced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__GetWindowLongW#8 ref
erenced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__SetWindowLongW#12 re
ferenced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__FindWindowW#8 refere
nced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__CommandLineToArgvW#8
referenced in function _is_topmost_requested
main.exe : fatal error LNK1120: 7 unresolved externals
Those unresolved external problems are likely due to you not properly linking the libraries that those functions are from. In your project settings, go to project properties. Expand configuration properties, then expand linker. In the linker's input settings, you can specify libraries that the program requires in the "additional dependencies" option.

Why am I not able to build Vim with Visual Studio 2015 RC command line tools?

Yesterday, I installed Visual Studio 2015 RC Community Edition. As a first test, I tried building GVim from source.
I opened a command window using "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts\VS2015 x64 Native Tools Command Prompt.lnk", set
set include=%include%;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
so Make_mvc.mak picks up the Win32.mak file. Also, I set:
set MSVCVER=12.0
as the make file does not detect the new Visual Studio version at this point.
After this, I have:
Framework40Version=v4.0
FrameworkDir=C:\Windows\Microsoft.NET\Framework64
FrameworkDIR64=C:\Windows\Microsoft.NET\Framework64
FrameworkVersion=v4.0.30319
FrameworkVersion64=v4.0.30319
FSHARPINSTALLDIR=C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\10\\include\10.0.10056.0\ucrt;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program Files (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
LIB=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.10056.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64;
LIBPATH=C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64;C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral;\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral;
MSVCVER=12.0
Platform=X64
PROCESSOR_ARCHITECTURE=AMD64
UniversalCRTSdkDir=C:\Program Files (x86)\Windows Kits\10\
VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\
VisualStudioVersion=14.0
VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 14.0\
windir=C:\Windows
WindowsSdkDir=C:\Program Files (x86)\Windows Kits\8.1\
WindowsSDK_ExecutablePath_x64=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\
WindowsSDK_ExecutablePath_x86=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\
I am able to build a simple program:
C:\...\Temp> type t.c
#include
int main(void) {
printf("Hello %s\n", "Stackoverflow.com");
return 0;
}
C:\...\Temp> cl t.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.22816 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
t.c
Microsoft (R) Incremental Linker Version 14.00.22816.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:t.exe
t.obj
C:\...\Temp> t.exe
Hello Stackoverflow.com
However, when I issue the command to build my GVim (something which works fine with Visual Studio 2013 CE tools), the compilation goes fine, but I get the following link errors:
C:\...\vim\src> nmake -f Make_mvc.mak CPU=AMD64 OPTIMIZE=SPACE GETTEXT=no NETBEANS=no CSCOPE=no DIRECTX=yes GUI=yes
I am snipping most of the error messages because there are a lot of them:
gui_dwrite.obj : error LNK2001: unresolved external symbol memcmp
blowfish.obj : error LNK2001: unresolved external symbol memcmp
crypt.obj : error LNK2001: unresolved external symbol memcmp
sha256.obj : error LNK2001: unresolved external symbol memcmp
undo.obj : error LNK2001: unresolved external symbol memcmp
blowfish.obj : error LNK2019: unresolved external symbol memcpy referenced in function bf_e_cblock
winclip.obj : error LNK2001: unresolved external symbol memcpy
screen.obj : error LNK2001: unresolved external symbol memcpy
sha256.obj : error LNK2001: unresolved external symbol memcpy
gui.obj : error LNK2001: unresolved external symbol memmove
gui_w32.obj : error LNK2001: unresolved external symbol memmove
tag.obj : error LNK2001: unresolved external symbol memmove
term.obj : error LNK2001: unresolved external symbol memmove
ui.obj : error LNK2001: unresolved external symbol memmove
undo.obj : error LNK2001: unresolved external symbol memmove
screen.obj : error LNK2001: unresolved external symbol memmove
search.obj : error LNK2001: unresolved external symbol memmove
spell.obj : error LNK2001: unresolved external symbol memmove
syntax.obj : error LNK2001: unresolved external symbol memmove
os_mswin.obj : error LNK2001: unresolved external symbol memmove
os_win32.obj : error LNK2001: unresolved external symbol memmove
quickfix.obj : error LNK2001: unresolved external symbol memmove
regexp.obj : error LNK2001: unresolved external symbol memmove
misc2.obj : error LNK2001: unresolved external symbol memmove
normal.obj : error LNK2001: unresolved external symbol memmove
ops.obj : error LNK2001: unresolved external symbol memmove
option.obj : error LNK2001: unresolved external symbol memmove
memline.obj : error LNK2001: unresolved external symbol memmove
menu.obj : error LNK2001: unresolved external symbol memmove
message.obj : error LNK2001: unresolved external symbol memmove
misc1.obj : error LNK2001: unresolved external symbol memmove
getchar.obj : error LNK2001: unresolved external symbol memmove
hashtab.obj : error LNK2001: unresolved external symbol memmove
mark.obj : error LNK2001: unresolved external symbol memmove
...
misc2.obj : error LNK2001: unresolved external symbol fwrite
spell.obj : error LNK2001: unresolved external symbol fwrite
edit.obj : error LNK2019: unresolved external symbol isalnum referenced in function ins_ctrl_ey
regexp.obj : error LNK2001: unresolved external symbol isalnum
ui.obj : error LNK2001: unresolved external symbol strncpy
gui_w32.obj : error LNK2001: unresolved external symbol strncpy
libXpm.lib(parse.obj) : error LNK2001: unresolved external symbol strncpy
libXpm.lib(data.obj) : error LNK2001: unresolved external symbol strncpy
regexp.obj : error LNK2001: unresolved external symbol strncpy
screen.obj : error LNK2001: unresolved external symbol strncpy
...
main.obj : error LNK2001: unresolved external symbol close
memfile.obj : error LNK2001: unresolved external symbol close
libXpm.lib(parse.obj) : error LNK2001: unresolved external symbol free
libXpm.lib(hashtab.obj) : error LNK2001: unresolved external symbol free
libXpm.lib(data.obj) : error LNK2001: unresolved external symbol free
libXpm.lib(misc.obj) : error LNK2001: unresolved external symbol free
...
eval.obj : error LNK2001: unresolved external symbol free
misc2.obj : error LNK2001: unresolved external symbol free
os_win32.obj : error LNK2001: unresolved external symbol free
gui_w32.obj : error LNK2001: unresolved external symbol free
libcmt.lib(new_scalar.obj) : error LNK2001: unresolved external symbol malloc
libXpm.lib(simx.obj) : error LNK2001: unresolved external symbol malloc
eval.obj : error LNK2001: unresolved external symbol malloc
misc2.obj : error LNK2001: unresolved external symbol malloc
os_win32.obj : error LNK2001: unresolved external symbol malloc
gui_w32.obj : error LNK2001: unresolved external symbol malloc
normal.obj : error LNK2001: unresolved external symbol realloc
regexp.obj : error LNK2001: unresolved external symbol realloc
libXpm.lib(simx.obj) : error LNK2001: unresolved external symbol realloc
eval.obj : error LNK2001: unresolved external symbol realloc
memline.obj : error LNK2001: unresolved external symbol realloc
misc1.obj : error LNK2001: unresolved external symbol realloc
misc2.obj : error LNK2001: unresolved external symbol realloc
...
ex_docmd.obj : error LNK2001: unresolved external symbol stricmp
ops.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
option.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
search.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
spell.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
fold.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
getchar.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
main.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
mark.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
eval.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
ex_cmds.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
ex_docmd.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
ex_getln.obj : error LNK2001: unresolved external symbol __stdio_common_vfprintf
window.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
gui.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
gui_w32.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
version.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
spell.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
syntax.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
tag.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
term.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
regexp.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
screen.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
search.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
sha256.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
ops.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
option.obj : error LNK2001: unresolved external symbol __stdio_common_vsprintf
...
_crt_atexit referenced in function _onexit
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol _crt_at_quick_exit referenced in function at_quick_exit
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol _cexit referenced in function __scrt_dllmain_uninitialize_c
libcmt.lib(exe_winmain.obj) : error LNK2001: unresolved external symbol _cexit
libcmt.lib(new_scalar.obj) : error LNK2019: unresolved external symbol _callnewh referenced in function "void * __cdecl operator new(unsigned __int64)" (??2#YAPEAX_K#Z)
libcmt.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _seh_filter_exe referenced in function "int `int __cdecl __scrt_common_main_seh(void)'::`1'::filt$0" (?filt$0#?0??__scrt_common_main_seh##YAHXZ#4HA)
libcmt.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _set_app_type referenced in function "int __cdecl pre_c_initialization(void)" (?pre_c_initialization##YAHXZ)
libcmt.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol __setusermatherr referenced in function "int __cdecl pre_c_initialization(void)" (?pre_c_initialization##YAHXZ)
libcmt.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _configure_narrow_argv referenced in function "int __cdecl pre_c_initialization(void)" (?pre_c_initialization##YAHXZ)
libcmt.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _get_narrow_winmain_command_line referenced in function "int __cdecl __scrt_common_main_seh(void)" (?__scrt_common_main_seh##YAHXZ)
libcmt.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _initterm referenced in function "int __cdecl __scrt_common_main_seh(void)" (?__scrt_common_main_seh##YAHXZ)
...
libXpm.lib(rgb.obj) : error LNK2019: unresolved external symbol strdup referenced in function xpmGetRGBfromName
oldnames.lib(strdup.obj) : error LNK2001: unresolved external symbol strdup
oldnames.lib(strdup.obj) : error LNK2001: unresolved external symbol _strdup
gvim.exe : fatal error LNK1120: 183 unresolved externals
I feel like I am missing something obvious. What changed between VS 2013 and VS 2015?
It turns out this had already been reported on vim_dev mailing list, and is due to the re-organization of the C runtime.
Specifically, the /nodefaultlib option for the linker seems to cause the problem.
The patch included in Paul Moore's follow-up worked for me.
The pre-compiled XPM library included with Vim seems to statically link to MSVCRT. This issue is mentioned in CRT Library Features:
If you have more than one DLL or EXE, then you may have more than one CRT, whether or not you are using different versions of Visual C++. For example, statically linking the CRT into multiple DLLs can present the same problem. Developers encountering this problem with static CRTs have been instructed to compile with /MD to use the CRT DLL. Now that the CRT DLL has been renamed to msvcr110.dll, applications may have some components linked to msvcrt.dll and others to msvcr110.dll. If your DLLs pass CRT resources across the msvcrt.dll and msvcr110.dll boundary, you will encounter issues with mismatched CRTs and need to recompile your project with Visual C++.
I haven't tried to re-compile the included XPM library with VS2015, so XPM support is disabled in my GVim for now.

vtk tcl wrapping

I'm trying to build VTK with VTK_WRAP_TCL=ON and VTK_USE_TK=ON but having following linker errors:
> Compiling...
vtkTkAppInit.cxx
Compiling resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
Creating library D:\VTK\bin\bin\Debug\vtk.lib and object D:\VTK\bin\bin\Debug\vtk.exp
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tk_MainEx referenced in function _main
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tcl_CreateInterp referenced in function _main
vtkCommonTCL.lib(vtkTclUtil.obj) : error LNK2001: unresolved external symbol __imp__Tcl_CreateInterp
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tcl_SetVar referenced in function _Tcl_AppInit
vtkCommonTCL.lib(vtkTclUtil.obj) : error LNK2001: unresolved external symbol __imp__Tcl_SetVar
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tcl_Eval referenced in function _Tcl_AppInit
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tk_Init referenced in function _Tcl_AppInit
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tcl_Init referenced in function _Tcl_AppInit
vtkCommonTCL.lib(vtkTclUtil.obj) : error LNK2019: unresolved external symbol __imp__Tcl_GetAssocData referenced in function "struct vtkTclInterpStruct * __cdecl vtkGetInterpStruct(struct Tcl_Interp *)" (?vtkGetInterpStruct##YAPAUvtkTclInterpStruct##PAUTcl_Interp###Z)
vtkFilteringTCL.lib(vtkSourceTcl.obj) : error LNK2019: unresolved external symbol __imp__Tcl_DeleteCommand referenced in function "int __cdecl vtkSourceCppCommand(class vtkSource *,struct Tcl_Interp *,int,char * * const)" (?vtkSourceCppCommand##YAHPAVvtkSource##PAUTcl_Interp##HQAPAD#Z)
vtkRenderingTCL.lib(vtkAbstractVolumeMapperTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkRenderingTCL.lib(vtkImporterTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkWidgetsTCL.lib(vtkContinuousValueWidgetRepresentationTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkProcessObjectTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkMapper2DTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkViewportTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkAbstractMapperTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkThreadedImageAlgorithmTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkImageInPlaceFilterTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkRectilinearGridSourceTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
.
.
D:\VTK\bin\bin\Debug\vtk.exe : fatal error LNK1120: 65 unresolved externals
Results
Build log was saved at "file://d:\VTK\bin\Wrapping\Tcl\vtk.dir\Debug\BuildLog.htm"
vtk - 22432 error(s), 0 warning(s)
Please help to solve.
Thanks.
I installed Tclx64 version and was trying to build it with 32 bit compiler.
Problem is solved by installing x86 version and compiled it with Debug|Win32.
http://public.kitware.com/pipermail/vtkusers/2011-September/118696.html this post helped me to understand the problem.

Resources