Build error with "___report_rangecheckfailure" with OpenSSL libs - c++

Using VC++ 2010
Compiling with OpenSSL libraries to make a SHA512 hash...
getting this build error:
1>------ Build started: Project: Second, Configuration: Debug Win32 ------
1> stdafx.cpp
1> AssemblyInfo.cpp
1>Second.cpp
1> Second.cpp(64): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371) : see declaration of 'sprintf'
1> Generating Code...
1> .NETFramework,Version=v4.0.AssemblyAttributes.cpp
1> Microsoft (R) Incremental Linker Version 10.00.40219.01
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> "/OUT:C:\Users\Boss\documents\visual studio 2010\Projects\Second\Debug\Second.exe" /INCREMENTAL "C:\Program Files\OpenSSL-Win32\lib\VC\static\ssleay32MD.lib" "C:\Program Files\OpenSSL-Win32\lib\VC\static\libeay32MD.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 /ASSEMBLYRESOURCE:Debug\Second.Form1.resources /MANIFEST "/ManifestFile:Debug\Second.exe.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:C:\Users\Boss\documents\visual studio 2010\Projects\Second\Debug\Second.pdb" /ASSEMBLYDEBUG /SUBSYSTEM:WINDOWS /TLBID:1 "/ENTRY:main" /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 Debug\app.res
1> Debug\AssemblyInfo.obj
1> Debug\Second.obj
1> Debug\stdafx.obj
1> "Debug\.NETFramework,Version=v4.0.AssemblyAttributes.obj"
1>libeay32MD.lib(obj_dat.obj) : error LNK2019: unresolved external symbol ___report_rangecheckfailure referenced in function _OBJ_create_objects
1>libeay32MD.lib(b_print.obj) : error LNK2001: unresolved external symbol ___report_rangecheckfailure
1>C:\Users\Boss\documents\visual studio 2010\Projects\Second\Debug\Second.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Tried disabling buffer overrun security check, same error..
Any thoughts? Tried all day with Crypto++, to no avail, OpenSSL was much easier, just hung up on this one error...

It looks as though you are trying to link to OpenSSL libraries that were built with a later version of the compiler.
Function ___report_rangecheckfailure was introduced in more recent versions of Visual Studio (see http://blogs.microsoft.com/cybertrust/2012/01/26/enhancements-to-gs-in-visual-studio-11/ for details).
So the linker is looking in the VS2010 libraries to find a function that didn't exist until later.
The maintainer of at least one of the pre-built OpenSSL libraries for Windows has recently switched from using an earlier version of Visual Studio, which may be the trigger for your problems.
One solution is to build your own OpenSSL Windows binaries with VS2010 (See http://developer.covenanteyes.com/building-openssl-for-visual-studio/ for example).

Related

CMake build showing VS compiler error: cl.exe - broken and LINK error: cannot open 'kernel32.lib'

I've been trying to build some code using CMake via PowerShell(administrator).
I've run Microsoft Visual Studio 10.0\VC\vcvarsall.bat for setting environment variables.
I also set every environment variable required for this project (for CMake, BUILD_ROOT, etc).
Also, I've windows SDK version 8.0 and 8.1 in the system.
But, when I try to compile, I get a compiler broken error and a 'kernel32.lib' missing error, even though 'kernel32.lib' is there in the windows SDK path.
Can anyone provide me with a possible solution, please?
Attaching the PowerShell Output below:
> PS > C:\project\build-dir> cmake ..
> -DBUILD_CLASSIFIER=Windows-x64-VS100 -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" $env:BUILD_ROOT\3rd_Party\lib-6.5.1
-- The C compiler identification is MSVC 16.0.30319.1
-- The CXX compiler identification is MSVC 16.0.30319.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe - broken CMake Error at C:/Program
Files/CMake/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69
(message): The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/build-dir/CMakeFiles/CMakeTmp
Run Build Command(s):nmake -f Makefile /nologo cmTC_cefcc\fast && "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"
-f CMakeFiles\cmTC_cefcc.dir\build.make /nologo -L CMakeFiles\cmTC_cefcc.dir\bu ild
Building C object CMakeFiles/cmTC_cefcc.dir/testCCompiler.c.obj
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\cmTC_cefcc.dir\testCCom
piler.c.obj.d
--working-dir=C:\GITWS\CP.24.0_dev_New\print_server\CMService\colorToolKit\ctk-build\CMakeFiles\CMakeTmp -
-filter-prefix="Note: including file: " -- C:\PROGRA~2\MICROS~4.0\VC\bin\cl.exe
#C:\Users\ADMINI~1.XER\AppData\Local\Tem p\nm8FBD.tmp
testCCompiler.c
Linking C executable cmTC_cefcc.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_cefcc.dir --rc=C:\PROGRA~2\MICROS ~1\Windows\v7.0A\Bin\RC.Exe
--mt=C:\PROGRA~2\MICROS~1\Windows\v7.0A\Bin\mt.exe --manifests -- C:\PROGRA~2\MICROS~4.0\VC\ bin\link.exe /nologo
#CMakeFiles\cmTC_cefcc.dir\objects1.rsp
#C:\Users\ADMINI~1.XER\AppData\Local\Temp\nm904A.tmp
LINK Pass 1: command "C:\PROGRA~2\MICROS~4.0\VC\bin\link.exe /nologo #CMakeFiles\cmTC_cefcc.dir\objects1.rsp /out:cm TC_cefcc.exe
/implib:cmTC_cefcc.lib
/pdb:C:\GITWS\CP.24.0_dev_New\print_server\CMService\colorToolKit\ctk-build\CMakeFil
es\CMakeTmp\cmTC_cefcc.pdb /version:0.0 /machine:X86 /debug
/INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi3
2.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFi
les\cmTC_cefcc.dir/intermediate.manifest
CMakeFiles\cmTC_cefcc.dir/manifest.res" failed (exit code 1104) with
the follow ing output:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"' : return code '0 x2'
Stop.
CMake will not be able to correctly generate this project. Call
Stack (most recent call first): CMakeLists.txt:4 (PROJECT)
-- Configuring incomplete, errors occurred! See also "C:/project/build-dir/CMakeFiles/CMakeOutput.log". See also
"C:/project/build-dir/CMakeFiles/CMakeError.log".

Detection of icu libs fails with VS2017

I'm building Qt 5.11.1 from sources with VS2017 build tools.
The environment I set is as follows:
set QTDIR=%CD%
set PATH=%PATH%;%QTDIR%\qtbase\bin;C:\Oracle11\client11.2.0\bin;C:\Python27\;C:\ruby_2.0.0\bin;C:\Python27\Scripts\;C:\Perl64\site\bin;C:\Perl64\bin;C:\GnuWin32\bin;C:\icu\bin64
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat"
set INCLUDE=%INCLUDE%;C:\app\client\x\product\12.2.0\client_1\oci\include;C:\Python27\include;C:\ruby_2.0.0\include;"C:\mysql-5.5\include;C:\icu\include";"C:\Program Files (x86)\Windows Kits\10\Include"
set LIB=%LIB%;C:\app\client\x\product\12.2.0\client_1\oci\lib\msvc;C:\Python27\Lib;C:\ruby_2.0.0\lib;"C:\mysql-5.5\lib";C:\icu\lib64;"C:\Program Files (x86)\Windows Kits\10\Lib"
then call the configure script:
configure -prefix %QTDIR%\_STAGE -platform win32-msvc -commercial -confirm-license -release -shared -qt-libjpeg -qt-libpng -no-cups -no-mtdev -nomake examples -icu -plugin-sql-mysql -plugin-sql-odbc -plugin-sql-sqlite -opengl dynamic -skip qtconnectivity -skip webengine -D _IGNORE_FINAL
The script does some work, and when checking the configurations, it fails - cannot find icu:
ERROR: Feature 'icu' was enabled, but the pre-condition 'libs.icu' failed.
Check config.log for details.
Here's the relevant part from config.log:
loaded result for library config.qtbase_corelib.libraries.icu
Trying source 0 (type inline) of library icu ...
=> source failed condition 'config.win32 && !features.shared'.
Trying source 1 (type inline) of library icu ...
+ cd /d C:\Users\x\Documents\qt\config.tests\icu && C:\Users\x\Documents\qt\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "DEFINES += _IGNORE_FINAL" "LIBS += -licuin -licuuc -licudt" C:/Users/x/Documents/qt/config.tests/icu
+ cd /d C:\Users\x\Documents\qt\config.tests\icu && set MAKEFLAGS=& nmake
> Microsoft (R) Program Maintenance Utility Version 14.15.26726.0
> Copyright (C) Microsoft Corporation. All rights reserved.
> cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -O2 -MD -W0 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_IGNORE_FINAL -DNDEBUG -I. -IC:\Users\x\Documents\qt\qtbase\mkspecs\win32-msvc -Fo #C:\Users\x\AppData\Local\Temp\8\nm8F4F.tmp
> main.cpp
> link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:icu.exe #C:\Users\x\AppData\Local\Temp\8\nm91F0.tmp
> main.obj : error LNK2019: unresolved external symbol ucol_open_57 referenced in function main
> main.obj : error LNK2019: unresolved external symbol ucol_close_57 referenced in function main
> icu.exe : fatal error LNK1120: 2 unresolved externals
> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\link.EXE"' : return code '0x460'
> Stop.
I tried to build the standalone main.cpp from config.tests\icu with
cl main.cpp /EHsc
and got the same linker error. Then I added the libs path and the libs and the build succeeded:
cl main.cpp /EHsc /link /LIBPATH:C:\icu\lib64 icudt.lib icuin.lib icuio.lib icule.lib iculx.lib icutu.lib icuuc.lib
But when I added the libs to configure script, got the same linker error.
Any idea what I'm doing wrong or missing?
try to move icu lib path to the first and re-configure seems solve the problem
set lib=D:\Qt\Qt5.11.1\third-party\icu-lib\lib;%lib%
test Qt5.11.1 in VS2017 5.8.4 32bit
D:\Qt\Qt5.11.1>cd D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu
D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu>set lib
LIB=D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\ATLMFC\lib\x86;D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\lib\x86;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x86;C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86;;D:\Qt\Qt5.11.1\third-party\icu-lib\lib;D:\Qt\Qt5.11.1\third-party\openssl-lib\lib
LIBPATH=D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\ATLMFC\lib\x86;D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\lib\x86;D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17134.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.17134.0;C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;
D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu>nmake
Microsoft (R) Program Maintenance Utility Version 14.15.26729.0
Copyright (C) Microsoft Corporation. All rights reserved.
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:icu.exe #C:\Users\harry\AppData\Local\Temp\nm8ACC.tmp
LINK : icu.exe not found or not built by the last incremental link; performing full link
main.obj : error LNK2019: unresolved external symbol _ucol_open_62 referenced in function _main
main.obj : error LNK2019: unresolved external symbol _ucol_close_62 referenced in function _main
icu.exe : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86\link.EXE"' : return code '0x460'
Stop.
D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu>set lib=D:\Qt\Qt5.11.1\third-party\icu-lib\lib;%lib%
D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu>nmake
Microsoft (R) Program Maintenance Utility Version 14.15.26729.0
Copyright (C) Microsoft Corporation. All rights reserved.
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:icu.exe #C:\Users\harry\AppData\Local\Temp\nmA818.tmp

error MSB3073: :VCEnd" exited with code 2

I Know this problem been posted and I search the internet looking for the solution of my problem. I am new to programming and I try to find the answer before posting my problem.
I am trying to do a code interface node for Labview. Follow the direction and of course search on the internet. I setup my environment variables to point where my files are at. I set up the property page and were I am having the trouble at is on the command line in the custom build set up. I enter the following command:
"$(CINTOOLSDIR)\lvsbutil" "$(TargetName)" -d "$(OutDir)"
and for the Output I enter
$(OutDir) $(TargetName).lsb.
`
when I build the code I get the following.
'
Project: SimpleCIN2010, Configuration: Release Win32 ------
1>C:\Program Files(x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(298,5): warning MSB8004: Intermediate Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Intermediate Directory.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(299,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
1> SimpleCIN2010.cpp
1> Microsoft (R) Incremental Linker Version 10.00.40219.01
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> "/OUT:.\Release\SimpleCIN2010.dll" /INCREMENTAL "/LIBPATH:C:\Program Files (x86)\National Instruments\LabVIEW 8.6\cintools" cin.obj labview.lib lvsb.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 "/DEF:C:\Program Files (x86)\National Instruments\LabVIEW 8.6\cintools\lvsbmain.def" /MANIFEST "/ManifestFile:.\Release\SimpleCIN2010.dll.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:C:\Users\XXX\Documents\Visual Studio 2010\Projects\CIN VC2010\SimpleCIN2010\SimpleCIN2010\Release\SimpleCIN2010.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:.\Release\SimpleCIN2010.lib" /MACHINE:X86 /DLL .\Release\SimpleCIN2010.dll.embed.manifest.res
1> .\Release\SimpleCIN2010.obj
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
1>SimpleCIN2010.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
1> Creating library .\Release\SimpleCIN2010.lib and object .\Release\SimpleCIN2010.exp
1> Microsoft (R) Incremental Linker Version 10.00.40219.01
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> "/OUT:.\Release\SimpleCIN2010.dll" /INCREMENTAL "/LIBPATH:C:\Program Files (x86)\National Instruments\LabVIEW 8.6\cintools" cin.obj labview.lib lvsb.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 "/DEF:C:\Program Files (x86)\National Instruments\LabVIEW 8.6\cintools\lvsbmain.def" /MANIFEST "/ManifestFile:.\Release\SimpleCIN2010.dll.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:C:\Users\XXX\Documents\Visual Studio 2010\Projects\CIN VC2010\SimpleCIN2010\SimpleCIN2010\Release\SimpleCIN2010.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:.\Release\SimpleCIN2010.lib" /MACHINE:X86 /DLL .\Release\SimpleCIN2010.dll.embed.manifest.res
1> .\Release\SimpleCIN2010.obj
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
1>SimpleCIN2010.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
1> Creating library .\Release\SimpleCIN2010.lib and object .\Release\SimpleCIN2010.exp
1> SimpleCIN2010.vcxproj -> C:\Users\XXXX\Documents\Visual Studio 2010\Projects\CIN VC2010\SimpleCIN2010\SimpleCIN2010\.\Release\SimpleCIN2010.dll
1> C:\Program Files (x86)\National Instruments\LabVIEW 8.6\cintools\lvsbutil: error building resource file: 1
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: The command ""C:\Program Files (x86)\National Instruments\LabVIEW 8.6\cintools\lvsbutil" "SimpleCIN2010" -d ".\Release\"
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: :VCEnd" exited with code 2.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========`
I went into the command line to double check for double spacing or not enough. I read the other article that been posted and try some of the codes. So if someone could tell me if I set up the command right please let me know.
Thanks
I finally found out that the issue was from trying to use two different version software. After over a week and many hours on the internet searching for an answer I came across an article on how to make the lsb file. First I had to remove the custom build commands and output from the property manager. rebuild the program to create my release folder under my project. once this was done i follow the following steps:
Executing cmd.exe When Compiling a CIN in VC++
You can reduce the introduction of typing errors and mis-quoting by following these steps:
1. Go to the start button and click run. Then type cmd in the command window and hit enter.
Browse to the directory that has lvsbutil.exe (in the cintools directory under LabVIEW), drag the lvsbutil.exe onto the cmd window. This will correctly quote the executable.
Browse to the folder that holds your dll, this is usually in /Debug of your project's directory, verify that a dll has been created there.
In the cmd window, type the following command: project_name -d
Drag the folder that contains the dll onto the cmd window, and press enter.
You should see LabVIEW resource file with the following properties created properly:
type: CIN
name: sharedcin.lsb
The .lsb file will be built in the same directory as the DLL.
Note: LabVIEW must be installed on the computer that the VC++ code is compiled on. Simply copying the cintools directory to the computer that will compile your code without having LabVIEW installed will cause an error when linking.

Linker Error Building GDAL

I am building GDAL from source using the MSVC 2015 64-bit command prompt. I am using Windows 8. Part way through the build, I get the following error:
Creating library gdal_i.lib and object gdal_i.exp
odbccp32.lib(dllload.obj) : error LNK2019: unresolved external symbol _vsnwprintf_s referenced in function StringCchPrintfW
gdal201.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.EXE"' : return code '0x460'
Stop.
I have read on the Microsoft Site and GDAL Git issues section that this was a problem with the 2014 MSVC and pre-release version of MSVC 2015, but the issue was supposed to be resolved prior to the final release of MSVC 2015.
https://github.com/mapbox/windows-builds/issues/53
https://connect.microsoft.com/VisualStudio/feedback/details/1134693/vs-2015-ctp-5-c-vsnwprintf-s-and-other-functions-are-not-exported-in-appcrt140-dll-breaking-linkage-of-static-libraries
I don't seem to be the only person with this issue, but I am also not seeing a solution (besides reverting to an older version of MSVC such as 2013). Has anybody had any luck getting GDAL to build using MSVC 2015 (64 bit)?
GDAL-2.1.0 already has a similar change on nmake.opt
!IFDEF ODBC_SUPPORTED
!IF $(MSVC_VER) >= 1900
# legacy_stdio_definitions.lib : https://connect.microsoft.com/VisualStudio/feedback/details/1134693/vs-2015-ctp-5-c-vsnwprintf-s-and-other-functions-are-not-exported-in-appcrt140-dll-breaking-linkage-of-static-libraries
ODBCLIB = legacy_stdio_definitions.lib odbc32.lib odbccp32.lib user32.lib
!ELSE
ODBCLIB = odbc32.lib odbccp32.lib user32.lib
!ENDIF
!ENDIF
but you must also specify the Visual Studio version from the command line with parameter MSVC_VER.
e.g. for Visual Studio 2015 (MSVC_VER==1900) use this command line to compile
nmake -f makefile.vc MSVC_VER=1900
I edited nmake.opt:
I replaced line 667 ... :
!IFDEF ODBC_SUPPORTED
ODBCLIB = odbc32.lib odbccp32.lib user32.lib
!ENDIF
with:
!IFDEF ODBC_SUPPORTED
!IF $(MSVC_VER) < 1900
ODBCLIB = odbc32.lib odbccp32.lib user32.lib
!ELSE
ODBCLIB = legacy_stdio_definitions.lib odbc32.lib odbccp32.lib user32.lib
!ENDIF
!ENDIF
/Anders
In addition to the above, I also had to make the following modification to the nmake.opt file:
the line that says
!IFNDEF MSVC_VER
#assume msvc VS2008.
MSVC_VER=1500
!ENDIF
Should be changed to:
!IFNDEF MSVC_VER
#assume msvc VS2015.
MSVC_VER=1900
!ENDIF

How to build SHTTPD on Windows?

I tried building SHTTPD on Windows using the following command:
nmake msvc Makefile
All i get is a bunch of errors. What am I doing wrong?
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. cl /MD /TC /nologo /DNDEBUG /Os standalone.c /link /out:shttpd.exe ws2_32.lib user32.lib advapi32.lib shell32.lib shttpd.lib standalone.c c:\users\samira\desktop\network\shttpd-1.42\src\compat_win32.h(46) : warning C4005: 'EWOULDBLOCK' : macro redefinition C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\errno.h(132) : see previous definition of 'EWOULDBLOCK' –
According to the site you link, you have to use the command
nmake win
to build on windows.
Edit From the site you linked:
Download the source package. Extract
it, go to src directory. Run "make
unix" there ("nmake win" on Windows,
requires MSVC). That buillds a
library.
Have you invoked the command from the src directory?