[gdal-dev] How to Use Gdal in Microsoft Visual Studio C++

Mateusz Loskot mateusz at loskot.net
Wed Oct 31 01:56:37 PDT 2018


On Wed, 31 Oct 2018 at 02:41, Athin <mfathin at csysint.com> wrote:
>
> I am still new in this GIS subject. May someone guide me how can i use gdal
> on Visual Studio 2012 c++.

In order to build and use current GDAL, you need Visual Studio 2015 or later.
GDAL requires C++11 compiler
https://trac.osgeo.org/gdal/wiki/rfc68_cplusplus11

You may try VS2013, which offers some C++11 support,
but it is not guaranteed to work at all.

> I try to follow from the website Gdal.org but i
> dont understand about it. How to generating visual studio project? How to
> generate_vcxproj.bat?

For example,

D:\gdal\gdal\> generate_vcxproj.bat 15.0 64 gdal_vs2017
Generating:
  "D:\gdal\gdal\gdal_vs2017.vcxproj"
  "D:\gdal\gdal\gdal_vs2017.vcxproj.user"
  "D:\gdal\gdal\gdal_vs2017.vcxproj.filters"
  "D:\gdal\autotest\cpp\gdal_vs2017_test.vcxproj"
  "D:\gdal\autotest\cpp\gdal_vs2017_test.vcxproj.user"
  "D:\gdal\autotest\cpp\gdal_vs2017_test.vcxproj.filters"
This might take a little while...
Projects done!
Launch Visual Studio IDE
* Open project "D:\gdal\gdal\gdal_vs2017.vcxproj"
* Add  project "D:\gdal\autotest\cpp\gdal_vs2017_test.vcxproj"
* Configure Build Dependencies to build the main project before the
test project.
* Save solution in .sln file
Done!

Finally, since you asked " guide me how can i use gdal",
you do not need VS project to build or use GDAL.
You can build GDAL library from command line using NMAKE and Makefiles provided
See https://trac.osgeo.org/gdal/wiki/BuildingOnWindows
(Note, the page has not been updated regarding minimum VS version
required, so assume it is VS2015).
Then, create your own application project in VS and configure it
setting include directories,
library directories, libraries for linker input.
If you don't know how to use VS, you will need to learn it from the
Microsoft docs, eg.
https://docs.microsoft.com/en-us/cpp/build/vscpp-step-1-create

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the gdal-dev mailing list