[gdal-dev] Setting up C++ environment with GDAL on CentOS

Dr. Joshua Jackson josh at nside.io
Wed Apr 15 12:42:04 PDT 2015


Thanks!  That worked great!


Joshua Jackson, PhD
Senior ResearchEngineer
 (800) 604-1822 Ext. 5109 <tel:8006041822,5109>   (256) 648-5109 <tel:2566485109>
 josh at nside.io <mailto:josh at nside.io>   www.nSide.io
 <http://www.nside.io/> 4031 Parkway Dr, Suite B, Florence, AL 35630
  <http://www.linkedin.com/company/nside/>  <http://twitter.com/nSide__Out>
> On Apr 15, 2015, at 2:10 PM, Kyle Shannon <kyle at pobox.com> wrote:
> 
> Joshua,
> 
> On 04/15/2015 12:58 PM, Dr. Joshua Jackson wrote:
>> Hey GDAL Team - I have a server running CentOS 6.  I have downloaded the
>> complete 1.11.2 source and successfully built and installed GDAL.
>> 
>> I am now trying to make my C++ program which uses GDAL and I’m not
>> having any luck.  I get an “unknown reference” error on all my calls to
>> GDAL methods. (GDALAllRegister, GDALOpen, etc).
>> 
>> On my #include I get an error if I use #include “gdal/gdal_priv.h”; but
>> it makes it past that point if I use #include “gdal_priv.h” alone.
> 
> #include "gdal_priv.h" is the proper syntax.  If you use a pre-built package from ubuntu or fedora or other package maintainer, they sometimes install the headers in a folder named gdal.  The standard build does not.
> 
>> 
>> I am using cmake with this project and here is my CMakeLists.txt below.
>>  I have manually set GDAL_INCLUDE_DIRS to be /usr/local/lib which is
>> where all the libgdal*.so files are located.
> 
> I believe the proper name is GDAL_INCLUDE_DIR and it needs to point to the headers so it should be /usr/local/include (assuming a standard installation, see above).
> 
>> 
>> cmake_minimum_required(VERSION 2.8)
>> project( AerialMask )
>> find_package( OpenCV )
>> find_package( GDAL )
>> include_directories(
>> ${OpenCV_INCLUDE_DIRS}
>> ${GDAL_INCLUDE_DIRS}
>> )
>> add_executable( AerialMask AerialMask.cpp )
>> target_link_libraries( AerialMask ${OpenCV_LIBS} )
> 
> You need to link to libgdal, so:
> 
> target_link_libraries( AerialMask ${OpenCV_LIBS} ${GDAL_LIBRARY} )
> 
>> 
>> 	
>> 
>> Joshua Jackson, PhD
>> 
>> Senior ResearchEngineer
>> 
>> (800) 604-1822 Ext. 5109 <tel:8006041822,5109>(256) 648-5109
>> <tel:2566485109>
>> 
>> josh at nside.io <mailto:josh at nside.io>www.nSide.io <http://www.nSide.io>
>> 
>> <http://www.nside.io/>4031 Parkway Dr, Suite B, Florence, AL 35630
>> 
>> <http://www.linkedin.com/company/nside/><http://twitter.com/nSide__Out>
>> 
>> 
>> 
>> 
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>> 
> 
> kss
> 
> -- 
> Kyle
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150415/1c687e41/attachment.html>


More information about the gdal-dev mailing list