= [wiki:FAQ] - Installation and Building = [[PageOutline(2,,inline)]] == Where can I find development version of GDAL? == You can checkout it directly from SVN repository. Visit [http://trac.osgeo.org/gdal/wiki/DownloadSource#Subversion Downloading GDAL/OGR Source] Wiki page for detailed instructions. == Can I get a MS Visual Studio Project file for GDAL? == The GDAL developers find it more convenient to build with makefiles and the [http://msdn2.microsoft.com/en-us/library/dd9y37ha(vs.80).aspx Visual Studio NMAKE] utility. Maintaining a parallel set of project files for GDAL is too much work, so there are no full project files directly available from the maintainers. There are very simple project files available since GDAL/OGR 1.4.0 that just invoke the makefiles for building, but make debugging somewhat more convenient. These are the makegdal71.sln and makegdal80.sln files in the GDAL root directory. Occasionally other users do prepare full project files, and you may be able to get them by asking on the [http://lists.maptools.org/mailman/listinfo/gdal-dev/ gdal-dev list]. However, I would strongly suggest you just use the NMAKE based build system. With debugging enabled you can still debug into GDAL with Visual Studio. == Can I build GDAL with MS Visual C++ 2005 Express Edition? == Yes, you can. It's also possible to use GDAL libraries in applications developed using [http://msdn.microsoft.com/vstudio/express/visualc/ Microsoft Visual C++ 2005 Express Edition]. * Download and install [http://msdn.microsoft.com/vstudio/express/visualc/download/ Visual C++ 2005 Express Edition]. Follow instructions presented on this website: * Download and install [http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ Microsoft Platform SDK]. Also, follow these instructions carefully without omitting any of steps presented there: * Add following two paths to Include files in the Visual C++ IDE settings. Do it the same way as presented in [http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ Step 3] from the website above. {{{ C:\\Program Files\\Microsoft Platform SDK\\Include\\atl C:\\Program Files\\Microsoft Platform SDK\\Include\\mfc }}} * Since you will build GDAL from command line using nmake tool, you also need to set or update ''INCLUDE'' and ''LIB'' environment variables manually. You can do it in two ways: 1. using the System applet available in the Control Panel 2. by editing vsvars32.bat script located in {{{ C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat }}} These variables should have following values assigned: {{{ INCLUDE=C:\\Program Files\\Microsoft Visual Studio 8\\VC\\Include; C:\\Program Files\\Microsoft Platform SDK\\Include; C:\\Program Files\\Microsoft Platform SDK\\Include\\mfc; C:\\Program Files\\Microsoft Platform SDK\\Include\\atl;%INCLUDE% LIB=C:\\Program Files\\Microsoft Visual Studio 8\\VC\\Lib; C:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0\\lib; C:\\Program Files\\Microsoft Platform SDK\\lib;%LIB% }}} '''NOTE:''' If you have edited system-wide ''INCLUDE'' and ''LIB'' variables, using System applet, every Console (cmd.exe) will have it properly set. But if you have edited them through ''vsvars32.bat'' script, you will need to run this script in the Console before every compilation. * Patch atlwin.h header At line 1725 add int i; declaration, so it looks as follows: {{{ BOOL SetChainEntry(DWORD dwChainID, CMessageMap* pObject, DWORD dwMsgMapID = 0) { int i; // first search for an existing entry for(i = 0; i < m_aChainEntry.GetSize(); i++) }}} * Patch atlbase.h header At line 287, comment ''AllocStdCallThunk'' and ''FreeStdCallThunk'' functions and add macros replacements: {{{ /*************************************************** PVOID __stdcall __AllocStdCallThunk(VOID); VOID __stdcall __FreeStdCallThunk(PVOID); #define AllocStdCallThunk() __AllocStdCallThunk() #define FreeStdCallThunk(p) __FreeStdCallThunk(p) #pragma comment(lib, "atlthunk.lib") ***************************************************/ /* NEW MACROS */ #define AllocStdCallThunk() HeapAlloc(GetProcessHeap(),0,sizeof(_stdcallthunk)) #define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p) }}} * Building GDAL * Open console windows (Start -> Run -> cmd.exe -> OK) * If you have edited vsvars32.bat script, you need to run it using full path: {{{ C:\> "C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools\\vsvars32.bat" Setting environment for using Microsoft Visual Studio 2005 x86 tools }}} * Go do GDAL sources root directory, for example: {{{ C:\> cd work\gdal }}} * Run nmake to compile {{{ C:\work\gdal> nmake /f makefile.vc }}} * If no errors occur, after a few minutes you should see GDAL libraries in C:\work\gdal. Now, you can use these libraries in your applications developed using Visual C++ 2005 Express Edition. == Can I build GDAL with Cygwin or MinGW? == GDAL should build with [http://www.cygwin.com/ Cygwin] using the Unix-like style build methodology. It is also possible to build with [http://www.mingw.org/ MinGW] and MSYS though there might be complications. The following might work: {{{ ./configure --prefix=$PATH_TO_MINGW_ROOT --host=mingw32 \ --without-libtool --without-python $YOUR_CONFIG_OPTIONS }}} Using external win32 libraries will often be problematic with either of these environments - at the least requiring some manual hacking of the GDALmake.opt file. Howto compile the (NG) Python bindings: {{{ cd swig\python python setup.py build -c mingw32 cp build\lib.win32-2.5\* c:\python25\lib\site-packages\ }}} (some details may need adjusting) Howto compile the Perl bindings: {{{ cd swig\perl perl Makefile.PL make.bat make.bat install }}} (the perl may need to be [http://www.adp-gmbh.ch/blog/2004/october/9.html compiled with MinGW]) If you have swig, the bindings can be regenerated in MSYS prompt by command "make generate". == Can I build GDAL with Borland C or other C compilers? == These are not supported compilers for GDAL; however, GDAL is mostly pretty generic, so if you are willing to take on the onerous task of building an appropriate makefile / project file it should be possible. You will find most portability issues in the [http://www.gdal.org/cpl__port_8h.html gdal/port/cpl_port.h] file and you will need to prepare a [http://www.gdal.org/cpl__config_8h-source.html gdal/port/cpl_config.h] file appropriate to your platform. Using [http://trac.osgeo.org/gdal/browser/trunk/gdal/port/cpl_config.h.vc cpl_config.h.vc] as a guide may be useful. == Why Visual C++ 8.0 fails with C2894 error in wspiapi.h when building GDAL with libcurl support? == Here is the complete error message of this issue: {{{ C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\wspiapi.h(44) : error C2894: templates cannot be declared to have 'C' linkage }}} This is a [http://curl.haxx.se/mail/tracker-2007-11/0027.html known bug] in the wspiapi.h header. One of possible solutions is to manually patch ''curl.h'' replacing lines '''153 - 154''' {{{ #include #include }}} with the following code: {{{ #ifdef __cplusplus } #endif #include #include #ifdef __cplusplus extern "C" { #endif }}} This problem occurs in [http://curl.haxx.se/libcurl/ libcurl] <= 7.17.1. Perhaps, later versions of libcurl will include this fix.