c++ - 如何将 gdal api 集成到 visual studio 2012 C++

标签 c++ visual-studio visual-studio-2010 visual-studio-2012 gdal

我是 geotiff 处理的新手。现在,我需要使用 gdal Api 读取我的 geotiff 数据。我想将 gdal 集成到 Visual Studio 中,以便我可以使用 C++。我已经通过推荐 makegdal_gen 10.00 64 > gdal10.vcproj 并成功地为 VS 项目生成了 gdal。但是,我丢失了几个在 gdal 目录或文件夹中不存在的 header ,例如 hdf.h 等。我想问一下,有人知道我在哪里可以找到完整的 gdal 或者有什么方法可以轻松地将 gdal 导入 visual studio C++ ?谢谢

最佳答案

生成gdal10.vcproj后,您需要构建它。

您应该遵循 official documentation .
主要步骤(从文档稍作修改,假设您有最新版本的 VS):

  • Check the basic options in nmake.opt, especially the settings for the VC variant to use and for the installation directory.

  • Open "Visual Studio Command Prompt" in the start menu. If you plan to compile for the 64bit platform be sure to choose the correct bat / command prompt.

  • Go to the GDAL root directory and do the following:

    C:\GDAL> nmake /f makefile.vc

  • Once the build has completed successfully, you can also install the required GDAL files for using GDAL utilities using the install makefile target. Ensure that BINDIR, and DATADIR are set appropriately in the nmake.opt file before doing this.

    C:\GDAL> nmake /f makefile.vc install

  • If you wish to build your own applications using GDAL you can use the following command to install all the required libraries, and include files as well. Ensure that LIBDIR and INCDIR are properly set in the nmake.opt file.

    C:\GDAL> nmake /f makefile.vc devinstall

Projects linking against GDAL should include the directory specified in INCDIR in the include path, and the directory specified in LIBDIR in their /LIBPATH. To use gdal link against the gdal_i.lib stub library.

关于c++ - 如何将 gdal api 集成到 visual studio 2012 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39471678/

相关文章:

c++ - 在目录 C++ 中搜索文件的函数输出错误

visual-studio - 在Visual Studio中是否有 'scratch pad'窗口

visual-studio-2010 - 如何从针对 64 位计算机的 VS 2010 解决方案调用 32 位 COM 互操作 dll

c++ - 类型 "const char **"的参数与类型 "const char *"的参数不兼容

c++ - 静态变量未初始化

c++ - 如果我按值(value)捕获但不使用它,我还能得到一份拷贝吗?

c++ - 在匿名命名空间中定义自定义相等运算符

visual-studio - Visual Studio 2010 中的 Resharper 快捷键

c++ - 让 VC 对话框编辑器识别命名空间中的对话框类

sql-server - 如何安装 Visual Studio 2010 Shell 以使用 SQL Server Data Tools?