[Gdal-dev] Re: MinGW & GDAL: "[Linker error] undefined reference..."

J.Krueger kruegerj at gmx.de
Tue Jul 27 16:35:18 EDT 2004


Frank Warmerdam wrote:
> I must confess I haven't been following this build issue closely.  However,
> there is one major issue.  GCC and GCC derived compilers used radically
> different "name munging" rules for C++ methods than MS Visual C++ does.  
> So, in general you won't be able to interact with C++ objects from a VC++ built
> library from gcc.

That would mean if I actually succeeded in building my own c++ gdal 
library with gcc I could use it, right? Or is that a code issue? If that 
would work I'd be happy if someone could provide me with his working 
library (if possible with support for the ERDAS .img format), as I tried 
my luck with the library already - without success (most likely due to 
my lack of experience).

> However, you should be able to use the GDAL C API as
> C function naming is uniform across compilers.
> So try implementing your code more along the lines of:
> 
>  int evaluate_Inputfiles(char* infile1, char* infile2) {
>   GDALAllRegister();
>   // Can the files be opened at all?
>   int check=0;
>   check=evaluate_Inputfile(infile1);
>   if (check) return 1;
>   check=evaluate_Inputfile(infile2);
>   if (check) return 1;
>   // Do they have the same size?
>   const char* filename1=infile1;
>   const char* filename2=infile2;
>   GDALDatasetH highresDataset, lowresDataset;
>   highresDataset = GDALOpen( filename1, GA_ReadOnly );
>   rastersizex = GDALGetRasterXSize( highresDataset );
>   rastersizey = GDALGetRasterYSize( highresDataset );
>   int xsize1 = rastersizex;
>   int ysize1 = rastersizey;
> ...
>   return 0;
> }

Mhh... the only change I see is that you're using 'GDALDatasetH' now 
instead of GDALDataset. Is that all I'd have to change? As I said in my 
first post - I'm a mere beginner as far as C/C++ is concerned. Basically 
I'm using my need for the tool I work on as a motivation to learn C++, 
so some stupid questions are to be expected... ;)



More information about the Gdal-dev mailing list