[gdal-dev] Error linking GDAL library in Eclipse C/C++ for Ubuntu

Sebastian Villarroya mithdrann at gmail.com
Thu Aug 4 14:13:35 EDT 2011


I am trying to build a C++ project that uses GDAL in Eclipse IDE C/C++ for
Ubuntu.
I have installed libgdal 1.7.3 provided by Ubuntugis using Synaptics Package
Manager.

I wrote a dummy code to test this installation

      #include <iostream>
      #include "gdal_priv.h"
      #include "cpl_conv.h" // for CPLMalloc()

      using namespace std;

      int main() {
	   GDALAllRegister();

	   cout << "!!!Do Nothing!!!" << endl;
	   return 0;
      }

I configured Project>properties>C/C++ Build>settings in order to have:
  
  GCC C++ Compiler > Includes: 
        /usr/include
        /usr/include/gdal

  GCC C Compiler > Includes:
        /usr/include
        /usr/include/gdal

  GCC C++ Linker > Libraries:
       -l/usr/lib/libgdal1.7.0.so

But when I build the code I get the next error:

make all 
Building target: prueba3
Invoking: GCC C++ Linker
g++  -o "prueba3"  ./src/prueba3.o   -l/usr/lib/libgdal1.7.0.so
/usr/bin/ld: cannot find -l/usr/lib/libgdal1.7.0.so
collect2: ld returned 1 exit status
make: *** [prueba3] Error 1

You can see that I have properly installed the libgdal1.7.0.so file:

sebas at sebas-ubuntu:/usr/lib$ ls -l  libgdal1.7.0.so
lrwxrwxrwx 1 root root 22 2011-08-04 15:02 libgdal1.7.0.so ->
libgdal1.7.0.so.1.14.3

I would be very grateful if someone could help me to fix this error.
Sebastian.


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Error-linking-GDAL-library-in-Eclipse-C-C-for-Ubuntu-tp6653712p6653712.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list