Recently in the study of open source GIS library gdal, I used to download the source code to compile the way, mainly in the following several steps:
- Download gdal source, download page for Https://trac.osgeo.org/gdal/wiki/DownloadSource, currently the latest version of the 2.0.1,windows version for the http://download.osgeo.org/ Gdal/2.0.1/gdal201.zip
After downloading the extract, I extracted here to the C packing directory, and in the root directory to create a new folder Gdal-runtime, as a result of storing the compilation:
- Enter gdal-2.0.1, open the nmake.opt file, locate gdal_home, and change the value to the path gdal-runtime the previous step.
Find msvc_ver to change the value to the current version of Visual Studio, I use VS2012, the value is 1700
gdal1.6 and before the seemingly also need to change the source files, 2.0.1 do not
- Open the command-line tool that comes with Visual Studio:
Go to the Gdal folder,cd "C:\gdal-2.0.1", and execute the following command in turn (it takes a little time):
nmake/f makefile. /F Makefile. /F makefile.vc devinstall
After compiling, the following folder will be generated in "C:\gdal-runtime" to represent the successful compilation
- Create a new Codeblocks project, copy the Gdalxxx.dll from the previous "C:\gdal-runtime\bin" directory to the project root directory
Open the Project-build Options menu and add "C:\gdal-runtime\lib\gdal_i.lib" to link libraries under Linker settings
In search Directories-complier , add the path "C:\gdal-runtime\include"in the "search add "C:\gdal-runtime\lib " in Directories-linker "
- The configuration is complete here, and here are some common issues:
1. If you are prompted to not find NMAKE, you need to join the folder "C:\Program Files\Microsoft Visual Studio 12.0\vc\bin" that NMAKE is in to the system path, and then reopen the command line
2. If you call NMAKE compile-time prompt "stdio.h not found", you will need to add the Windows SDK and the include path to Visual Studio in the system variable include (new if it does not exist)
3. If you are prompted with an "RC" variable error, you need to perform "C:\Program Files\Microsoft Visual Studio 12.0\vc\bin\vcvars32.bat" before you execute NMAKE
Open source GIS Library gdal configuration under Windows Codeblocks