以前都是在vc6.0上使用开源的shapelib库,最近要使用filegdb api,因此必须使用vs 2008,因此使用vs 2008的nmake命令来编译一下shapelib库,但是在编译过程报如下错误:
D:/shapelib-1.3.0b2>nmake -f makefile.vc
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT -c shpopen.c
NMAKE : fatal error U1077: '"D:/Program Files/Microsoft Visual Studio 9.0/VC/bin
/cl.EXE"' : return code '0xc0000135'
Stop.
发现是vc 9的cl(compile link)文件出了问题,但是无法确定到底出了什么问题,因此在cmd下直接运行cl后发现
报如下错误:
找不到mspdb80.dll这个动态库,搜了一下vs2008的目录,发现"D:/Program Files/Microsoft Visual Studio 9.0/VC/bin
目录下的确没有这个文件,但是在"D:/Program Files/Microsoft Visual Studio 9.0/Common7/IDE”目录下有这个动态库,
将mspdb80.dll拷贝到D:/Program Files/Microsoft Visual Studio 9.0/VC/bin后,继续运行nmake后,继续报错:
D:/shapelib-1.3.0b2>nmake -f makefile.vc
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT -c shpopen.c
shpopen.c
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT -c dbfopen.c
dbfopen.c
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT -c shptree.c
shptree.c
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT -c safileio.c
safileio.c
lib /nologo /out:shapelib.lib shpopen.obj dbfopen.obj shptree.obj safile
io.obj
link /nologo /dll /out:shapelib.dll /implib:shapelib_i.lib shpopen.obj d
bfopen.obj shptree.obj safileio.obj
Creating library shapelib_i.lib and object shapelib_i.exp
if exist shapelib.dll.manifest mt /nologo -manifest shapelib.dll.manifes
t -outputresource:shapelib.dll;2
'mt' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
NMAKE : fatal error U1077: 'if' : return code '0x1'
Stop.
找不到mt.exe,到硬盘上继续找,发现在SDK中有这个文件,因此将SDK加入到PATH环境变量中,继续nmake编译,搞定:
D:/shapelib-1.3.0b2>nmake -f makefile.vc
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT -c shpopen.c
shpopen.c
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT -c dbfopen.c
dbfopen.c
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT -c shptree.c
shptree.c
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT -c safileio.c
safileio.c
lib /nologo /out:shapelib.lib shpopen.obj dbfopen.obj shptree.obj safile
io.obj
link /nologo /dll /out:shapelib.dll /implib:shapelib_i.lib shpopen.obj d
bfopen.obj shptree.obj safileio.obj
Creating library shapelib_i.lib and object shapelib_i.exp
if exist shapelib.dll.manifest mt /nologo -manifest shapelib.dll.manifes
t -outputresource:shapelib.dll;2
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT shpcreate.c shapelib_i.lib
shpcreate.c
if exist shpcreate.exe.manifest mt -manifest shpcreate.exe.manifest -out
putresource:shpcreate.exe;1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT shpadd.c shapelib_i.lib
shpadd.c
if exist shpadd.exe.manifest mt -manifest shpadd.exe.manifest -outputres
ource:shpadd.exe;1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT shpdump.c shapelib_i.lib
shpdump.c
if exist shpdump.exe.manifest mt -manifest shpdump.exe.manifest -outputr
esource:shpdump.exe;1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT shprewind.c shapelib_i.lib
shprewind.c
if exist shprewind.exe.manifest mt -manifest shprewind.exe.manifest -out
putresource:shprewind.exe;1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT dbfcreate.c shapelib_i.lib
dbfcreate.c
if exist dbfcreate.exe.manifest mt -manifest dbfcreate.exe.manifest -out
putresource:dbfcreate.exe;1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT dbfadd.c shapelib_i.lib
dbfadd.c
if exist dbfadd.exe.manifest mt -manifest dbfadd.exe.manifest -outputres
ource:dbfadd.exe;1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT dbfdump.c shapelib_i.lib
dbfdump.c
if exist dbfdump.exe.manifest mt -manifest dbfdump.exe.manifest -outputr
esource:dbfdump.exe;1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT shptest.c shapelib_i.lib
shptest.c
if exist shptest.exe.manifest mt -manifest shptest.exe.manifest -outputr
esource:shptest.exe;1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
cl /nologo /Ox /MD /DSHAPELIB_DLLEXPORT shptreedump.c shapelib_i.lib
shptreedump.c
if exist shptreedump.exe.manifest mt -manifest shptreedump.exe.manifest
-outputresource:shptreedump.exe;1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.