[Gdal-dev] Re: [FWTools] Debugging under Windows XP and Visual Studio .Net

Mateusz Loskot mateusz at loskot.net
Thu Nov 30 11:51:23 EST 2006


Martin Fix wrote:
 > How could I build a solution for VC7 or VC8 to debug the GDAL code
> itself? I then can make a small test program just to test the things
> I need to know. Has anybody done this before?

I compile GDAL on Windows (nmake /f makefile.vc + debug flags inside
nmake.opt) and leave GDAL DLL and import library inside the gdal
directory, the sources tree.
Next, I create program under VC++ 2005 and configure project file to
link against library inside the gdal directory:

1. Add path to 'gdal' directory to:

Properties -> Linker -> Additional Library Directories

2. Add gdal_i.lib to:

Properties -> Linker -> Input -> Additional Dependencies

Next, add the path to 'gdal' directory, where also GDAL DLL lives,
to PATH environment from the Visual C++ IDE, so the GDAL DLL can be
found when executing your program from the IDE:

Go to project Properties -> Debugging -> Environment
and into the textbox put something like this:

PATH=D:\my\path\to\gdal

Then, you can set breakpoints directly inside GDAL sources.
You can also use F11 to step into the GDAL function calls from your
application.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list