c#版GDAL编译

目录

1、工具准备:swig

2、下载GDAL3编译版本(c++版本的编译)

3、成果展示(8个dll):

4、成果下载地址: 

5、声明


1、工具准备:swig

从链接处下载:   SWIG工具

2、下载编译版

链接:c++编译版

1、打开gdal源码目录,cd swig\csharp

nmake /f makefile.vc

2、出现错误解决方案:

1)(swig.exe不是有效的命令)

解决方案:将从1处下载的工具 “E:\008GDAL\GDAL\swigwin3\swig.exe ”根据你的路径将该路径加入到环境变量中

环境变量设置方法:环境变量

2)NMAKE : fatal error U1073: 不知道如何生成“ogr_wrap.obj”

执行如下命令:

nmake /f makefile.vc
nmake /f makefile.vc interface

具体执行过程如下: 

》》E:\008GDAL\GDAL\gdal\swig\csharp>nmake /f makefile.vc
Microsoft (R) 程序维护实用工具 14.22.27905.0 版
版权所有 (C) Microsoft Corporation。  保留所有权利。
        cd ogr
        nmake /nologo /f makefile.vc
        xcopy /D  /Y *.obj ..
复制了 0 个文件
        cd ..
        cd gdal
        nmake /nologo /f makefile.vc
        xcopy /D  /Y *.obj ..
复制了 0 个文件
        cd ..
        cd osr
        nmake /nologo /f makefile.vc
        xcopy /D  /Y *.obj ..
复制了 0 个文件
        cd ..
        cd const
        nmake /nologo /f makefile.vc
        xcopy /D  /Y *.obj ..
复制了 0 个文件
        cd ..
        csc /platform:x86 /define:CLR4  /target:library /out:osr_csharp.dll osr\
*.cs AssemblyInfo.cs
......
        link /dll   ogr_wrap.obj                      E:\008GDAL\OSGeo4W\lib\pro
j_6_2.lib E:\008GDAL\SQLite\lib\SQLite3.lib               legacy_stdio_definitio
ns.lib odbc32.lib odbccp32.lib user32.lib                             ws2_32.lib
  kernel32.lib psapi.lib ..\..\gdal_i.lib /out:ogr_wrap.dll
Microsoft (R) Incremental Linker Version 14.22.27905.0
Copyright (C) Microsoft Corporation.  All rights reserved.
  正在创建库 ogr_wrap.lib 和对象 ogr_wrap.exp 
  ......    
  正在创建库 gdal_wrap.lib 和对象 gdal_wrap.exp
  ......
  正在创建库 gdalconst_wrap.lib 和对象 gdalconst_wrap.exp
  ......
  正在创建库 osr_wrap.lib 和对象 osr_wrap.exp
  ......
》》E:\008GDAL\GDAL\gdal\swig\csharp>nmake /f makefile.vc install
Microsoft (R) 程序维护实用工具 14.22.27905.0 版
版权所有 (C) Microsoft Corporation。  保留所有权利。
......
复制了 4 个文件
......
复制了 4 个文件

3、成果展示(8个dll):

4、成果下载地址: 

   链接: c#版 GDAL3 (可直接在工程中使用)

      注:默认生成的为32位的dll

5、声明

以上通过本人测试与调试,是在项目中实践的方法,经过论证,可以实现,如有问题,请留言,谢谢你的阅读!

发布了35 篇原创文章 · 获赞 8 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/wenming111/article/details/100901088