我是Unix专家,并且创建了一个名为snmpdemo.c的.c文件-现在我需要编译并链接才能在Windows中创建snmpdemo.exe。我正在使用Visual Studio。
我通过查看现有的makefile,创建了以下makefile.txt:
PROGNAME=snmpdemo
LINKTYPE=static
CFLAGS=/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$(INTDIR)\ /Fd$(INTDIR)\$(PROGNAME).pdb /Fo$(INTDIR)\ /I C:\OpenSSL-Win64\include /c /W3 /Zi /nologo /wd4244 /wd4267 /MD /D NDEBUG /O2
LDFLAGS=/libpath:C:\OpenSSL-Win64\lib\VC
# Set to 1 to allow the building using the DLL version of SNMPLIB.
ALLOW_DLL=1
CPP=cl.exe
CPP_PROJ=/I.. /I..\..\include $(CFLAGS)
snmpdemo.obj::
$(CPP) $(CPP_PROJ) $(PROGNAME).c
RSC=rc.exe
LINK32=link.exe
LINK32_FLAGS=netsnmp.lib advapi32.lib ws2_32.lib kernel32.lib user32.lib /nologo /subsystem:console /pdb:"../bin/$(OUTDIR)/$(PROGNAME).pdb" /out:"..\bin\$(OUTDIR)/$(PROGNAME).exe" /libpath:"../lib/$(INTDIR)" $(LDFLAGS)
LINK32_OBJS= "$(PROGNAME).obj"
当我尝试编译时,出现以下错误:
$ nmake -f makefile.txt
Microsoft (R) Program Maintenance Utility Version 14.15.26730.0
Copyright (C) Microsoft Corporation. All rights reserved.
cl.exe /I.. /I..\..\include /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\ /Fd\snmpdemo.pdb /Fo\ /I C:\OpenSSL-Win64\include /c /W3 /Zi /nologo /wd4244 /wd4267 /MD /D NDEBUG /O2 snmpdemo.c
snmpdemo.c
snmpdemo.c: fatal error C1041: cannot open program database 'C:\snmpdemo.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS
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.
我该如何解决这个问题?