I need to compile arithchk.c (from the gdtoa library) on windows using visual studio 2013 running under cygwin. Everything was working fine with VS2008, but when I tried to switch to VS2013 I ran into this problem:
ladanyi@WIN64-01$ echo $LIB ;c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/LIB/amd64;c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/ATLMFC/LIB/amd64;c:/Program Files (x86)/Windows Kits/8.1/lib/winv6.3/um/x64; ladanyi@WIN64-01$ echo $INCLUDE ;c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/INCLUDE;c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/ATLMFC/INCLUDE;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; ladanyi@WIN64-01$ echo $PATH :/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 12.0/VC/BIN:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/Tools:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 12.0/VC/VCPackages:/cygdrive/c/Program Files (x86)/Windows Kits/8.1/bin/x64:/cygdrive/c/Program Files (x86)/Windows Kits/8.1/bin/x86:/usr/local/bin:/usr/bin:/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Intel/Composer XE 2011 SP1/redist/intel64/ipp:/cygdrive/c/Program Files (x86)/Intel/Composer XE 2011 SP1/redist/intel64/mkl:/cygdrive/c/Program Files (x86)/Common Files/Intel/Shared Libraries/redist/intel64/compiler:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdrive/c/Program Files (x86)/Microsoft SDKs/TypeScript/1.0:/cygdrive/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/cygdrive/c/Program Files/MATLAB/R2015b/bin ladanyi@WIN64-01$ LIB="$LIB" INCLUDE="$INCLUDE" cl -DNO_FPINIT arithchk.c -DNO_LONG_LONG -DNO_SSIZE_T /INCREMENTAL:NO /VERBOSE Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86 Copyright (C) Microsoft Corporation. All rights reserved. cl : Command line warning D9035 : option 'V' has been deprecated and will be removed in a future release arithchk.c Microsoft (R) Incremental Linker Version 12.00.40629.0 Copyright (C) Microsoft Corporation. All rights reserved. /out:arithchk.exe arithchk.obj arithchk.obj : error LNK2001: unresolved external symbol _asin arithchk.obj : error LNK2001: unresolved external symbol _exp arithchk.obj : error LNK2001: unresolved external symbol _log arithchk.obj : error LNK2001: unresolved external symbol _sqrt arithchk.obj : error LNK2001: unresolved external symbol _acos arithchk.obj : error LNK2019: unresolved external symbol ___iob_func referenced in function _main arithchk.obj : error LNK2019: unresolved external symbol _fprintf referenced in function _main arithchk.obj : error LNK2019: unresolved external symbol _printf referenced in function _ccheck arithchk.obj : error LNK2019: unresolved external symbol __errno referenced in function _main arithchk.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function _Lcheck arithchk.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function _Lcheck arithchk.obj : error LNK2001: unresolved external symbol __fltused LINK : error LNK2001: unresolved external symbol _mainCRTStartup arithchk.exe : fatal error LNK1120: 13 unresolved externals
LIB and INCLUDE and PATH are set to what the results is when I run vcvarsall.bat in a command window.
I just can't figure out why are those symbols unresolved and would greatly appreciate any help.
Thanks, --Laci
UPDATE
If I open a DOS command prompt, run vcvarsall.bat, and then compile, then it works just fine. Note that after running vcvarsall.bat and doing an echo %LIB%
and echo %INCLUDE%
I get the same values as above. So the problem is in the interaction with cygwin somewhere, just I can't figure out where, yet :-(...
*.lib
being used on the command line. You are not going to be able to compilearithchk.c
and get an executable, as there is notmain
in that file. – thurizascl -DNO_FPINIT arithchk.c -DNO_LONG_LONG -DNO_SSIZE_T /INCREMENTAL:NO /VERBOSE
(I get the warning about option 'v' being deprecated. I'd suggest trying from a VS command shell rather then a cygwin shell (guessing you are using cygwin based on you echo commands). – thurizas