[gdal-dev] used the GDAL/GEOS libraries (.dll and .lib) in my visual studio .net C++ project

Kolberg Sjur A Sjur.A.Kolberg at sintef.no
Thu Jan 8 10:14:57 EST 2009


Cui,

While you need to tell Visual Studio where to find the GDAL .h files (for compilation) and the .lib files (for linking), it is Windows you need to tell where to find the .dll files for running your executable.

Since it is Windows that needs to find the dll's, setting their address in VS doesn't help much. Windows will look for the necessary dll's in the location of your executable (by default \Debug and \Release, respectively), the system32 directory, or any directory that is mentioned in your PATH variable (Control Panel - System - Advanced - Environment Variables). Any other computer running your program must also have the GDAL dll's either together with the executable, in System32, or in a PATH'ed location.

With the PATH option, you can choose to extend the PATH variable either for yourself only, or for all users (System variables). I am never sure if a PATH update is effective until I've had the computer restarted. If you choose to keep the dll's with your executable, you'll need to copy them to both the debug and the release location. If you have the fwtools version of GDAL, this will typically be some 20 dll's.

There is no need to put the .lib (or .h) files in System32 or a PATH folder.

(By the way - if the GDAL library is something you use in several VS projects, it's easier to store the .h and .lib locations under Tools-Options-Projects and solutions-VC++ Directories, where the settings are not specific to configuration, project or solution. Only if you have both debug and release versions of GDAL it'll be necessary to use configuration specific .lib and .dll files. But this is the part of the problem you've already solved).

Good luck!
Sjur K :-)



Sjur Kolberg
SINTEF Energiforskning A/S
Sem Sælands vei 11
7465 Trondheim
tlf. 73 59 72 78
fax  73 59 72 50

________________________________
From: gdal-dev-bounces at lists.osgeo.org [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of chen cui
Sent: 8 januar 2009 13:47
To: gdal-dev at lists.osgeo.org
Subject: [gdal-dev] used the GDAL/GEOS libraries (.dll and .lib) in my visual studio .net C++ project

Hello,
I have successfully used the GDAL/GEOS libraries (.dll and .lib) in my VC++ project.
I just set the directory of where the gdal libraries are saved under the project property setting page - Additional Library Directories' and include directories. But when i run the debugging mode of my project,
the libraries are not found: gdal15.dll, geos_c.dll,geos_c_fw.dll even those files are saved under the library directory. After i copied those file into Windows/system32, then it worked well.
Is there any other way to solve this problem without saving the .dll files in the directory windows/system32?
my computer operation system is windowsxp.
thank you for your kind help!

best regards!

Cui

________________________________
check out the rest of the Windows Live(tm). More than mail-Windows Live(tm) goes way beyond your inbox. More than messages<http://www.microsoft.com/windows/windowslive/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090108/6ac31383/attachment-0001.html


More information about the gdal-dev mailing list