Visual Studio 2019 编译 masscan-1.3.2
1、下载 masscan
https://github.com/robertdavidgraham/masscan
2、编译
用 Vistual Studio 2019 加载工程文件 masscan-1.3.2\vs10\masscan.sln,提示升级构建环境(因作者是用vs10构建的工程),直接点升级。
正在升级项目“masscan”...
配置“Debug|Win32”: 将平台工具集更改为“v142”(之前为“v100”)。
配置“Debug|x64”: 将平台工具集更改为“v142”(之前为“v100”)。
配置“Release|Win32”: 将平台工具集更改为“v142”(之前为“v100”)。
配置“Release|x64”: 将平台工具集更改为“v142”(之前为“v100”)。
重定目标结束: 1 个已完成,0 个未通过,0 个已跳过
然后直接编译,报错:
编译出错的位置在 string_s.h 文件,原因是预设的编译环境没有命中到
#if defined(_MSC_VER) && (_MSC_VER == 1900)
修改成
#if defined(_MSC_VER) && (_MSC_VER == 1920)
再重新编译,成功。
3、总结
string_s.h 文件最上面的注释,已讲明了为什么。
/*
safe "string" functions, like Microsoft's
This is for the "safe" clib functions, where things like "strcpy()" is
replaced with a safer version of the function, like "strcpy_s()". Since
these things are non-standard, compilers deal with them differently.
Reference:
http://msdn.microsoft.com/en-us/library/bb288454.aspx
*/