简体   繁体   English

将GDAL合并到MSVS 2008 C ++项目中

[英]Incorporating GDAL into MSVS 2008 C++ project

I've been experimenting with GDAL in python and have had some great success in it's use for terrain analysis. 我一直在使用GDAL在python中进行实验,并且在将其用于地形分析方面取得了一些成功。 My company wants to see if/how GDAL can be used in Visual Studio, as it is their primary platform. 我的公司想看看GDAL是否/如何在Visual Studio中使用,因为这是他们的主要平台。

I've downloaded and installed GDAL v1.8 in accordance with the instructions found here under "Building from Source" I'm new to MSVS and not sure how to include the necessary headers to utilize the GDAL libraries in a new project. 我已经下载并按照中的说明安装GDAL V1.8 这里下的“建筑物的来源:”我是新来的MSVS和不知道如何将利用在新项目中的GDAL库必要的标头。

How do I include the libraries? 如何包含库? Your help is much appreciated! 非常感谢您的帮助!

If you are asking how to specify the GDAL include path in new Visual Studio projects, then you can do so under " C/C++ > General > Additional Include Directories ". 如果您询问如何在新的Visual Studio项目中指定GDAL包含路径,则可以在“ C / C ++>常规>其他包含目录 ”下进行指定。

Should there be any libraries to link to, then you can specify these under " Linker > Input > Additional Dependencies ". 如果要链接任何库,则可以在“ 链接器>输入>其他依赖项 ”下指定这些库。

Both of these settings can be found in your project's properties page. 这两个设置都可以在项目的属性页中找到。

After you successfully build GDAL you need three project settings (under Properties ): 成功构建GDAL之后,您需要三个项目设置(在Properties下):

  1. Set the path to the GDAL include directory at Configuration Properties -> C/C++ -> General -> Additional Include Directories Configuration Properties -> C/C++ -> General -> Additional Include Directories目录中, Configuration Properties GDAL包含目录的路径。
  2. Set the path to your lib directory (where gdal_i.lib is located) at Configuration Properties -> C/C++ > Linker > General > Additional Library Directories Configuration Properties -> C/C++ > Linker > General > Additional Library Directories将路径设置为您的lib目录( gdal_i.lib所在的位置)。
  3. Add gdal_i.lib to Configuration Properties -> C/C++ > Linker > Input > Additional Dependencies gdal_i.lib添加到Configuration Properties -> C/C++ > Linker > Input > Additional Dependencies

You can then use GDAL in your C++ code as described in the GDAL API tutorial . 然后,可以按照GDAL API教程中的说明在C ++代码中使用GDAL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM