我是 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/