我最近从他们的网站下载了Net-SNMP代码,并尝试在VC 2017中进行构建-失败。
解压缩的文件夹具有win32.dsp和win32dll.dsp-当我尝试在VC IDE中打开时,出现类似-
的错误消息
snmptrapd\snmptrapd.dsp: Unable to convert project. Please make sure this is a valid Visual C++ 6.0 project.
snmptrapd\snmptrapd.dsp: Project upgrade failed.
snmptrapd\snmptrapd.dsp: Converting project file 'C:\tools\netsnmp\net-snmp-5.8\win32\snmptrapd\snmptrapd.dsp'.
Hide 1 additional messages
几乎对于所有项目-通过命令行'nmake'实用程序进行的构建也会失败,并出现以下错误-
cd libagent
nmake /nologo all
cl.exe /I.. /I..\..\include /I..\..\agent\mibgroup /D WIN32 /D _BIND_TO_CURRENT_VCLIBS_VERSION /D _CONSOLE /D _CRT_NONSTDC_NO_WARNINGS /D _CRT_SECURE_NO_WARNINGS /D _MBCS /D _WINSOCK_DEPRECATED_NO_WARNINGS /EHsc /FD /FR.\release\ /Fd.\release\libagent.pdb /Fo.\release\ /I C:\OpenSSL-Win32\include /c /W3 /Zi /nologo /wd4244 /wd4267 /MD /D NDEBUG /O2 ..\..\agent\agent_handler.c ..\..\agent\agent_index.c ..\..\agent\agent_read_config.c ..\..\agent\agent_registry.c ..\..\agent\agent_sysORTable.c ..\..\agent\agent_trap.c ..\..\agent\snmp_agent.c ..\..\agent\snmp_vars.c
agent_handler.c
..\..\agent\agent_handler.c(19): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
agent_index.c
..\..\agent\agent_index.c(12): fatal error C1083: Cannot open include file: 'signal.h': No such file or directory
agent_read_config.c
..\..\agent\agent_read_config.c(16): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
agent_registry.c
..\..\agent\agent_registry.c(32): fatal error C1083: Cannot open include file: 'signal.h': No such file or directory
agent_sysORTable.c
..\..\agent\agent_sysORTable.c(3): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
agent_trap.c
..\..\agent\agent_trap.c(35): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
snmp_agent.c
..\..\agent\snmp_agent.c(50): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
snmp_vars.c
..\..\agent\snmp_vars.c(68): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\cl.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\nmake.EXE"' : return code '0x2'
Stop.
我们如何解决该问题?
答案 0 :(得分:0)
我也不能直接从VS2017进行构建。
根据文件README.win32,首先安装ActivePerl,然后运行win32 \ build.bat。
已更新:我刚刚推送了一个可解决编译问题的分支。看看这个:https://github.com/sanbrother/net-snmp/tree/Windows/v5.8
(解决方案文件net-snmp \ win32 \ win32dll.sln)
PS:看来,旧版本(可能在5.7.3之前???)没有这种问题。新代码将某些文件拆分为多个文件,并在Windows下导致编译问题。
答案 1 :(得分:0)
如果使用OpenSSL构建,则可能已设置INCLUDE和LIB路径,并替换了vcvars设置的路径。如果在运行vcvars之前设置INCLUDE和LIB可能会起作用。我与他们联系以解决此问题。