[galib] String compare operator with galib-2.4.6

Miguel Nicolau Miguel.Nicolau at ul.ie
Mon Mar 14 13:01:13 EST 2005


Hello again,

first, apologies for yet-another-possible-bug-report...

I think the new galib-2.4.6 must override the comparison operator 
(operator==) of the string class, somehow. Let me explain; here's an 
example program:


#include<string>
#include<iostream>
#include<ga/ga.h>
using namespace std;

class S : public string{
         public: int data;
};

int main(){
         S s1, s2;
         if(s1==s2) cout << "Equal\n";
         else cout << "Different\n";
         return 0;
}


Without the "#include<ga/ga.h>" line, this program compiles fine. With 
that line present, this program compiles fine under galib-2.4.5, but won't 
compile under galib-2.4.6; here's the error:


[xxx at xxxxx nicolaum]$ g++ test.cc
/home/xxx/tmp/ccY50XC3.o(.text+0x3b): In function `main':
: undefined reference to `int operator==<S>(S const&, S const&)'
collect2: ld returned 1 exit status


I'm not sure exactly what's happening there. The comparison of normal 
strings still works; but the comparison of objects whose class derives 
from string can't use the string::operator=() anymore. Probably a clash of 
operator signatures? I seem to remember that the string operator has a 
default return type of 'bool'.

Once again, sorry for giving you so much trouble... just trying to help!

All the best

Miguel


P.S. The same behaviour is observed on the following systems:

gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
gcc version 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)


More information about the galib mailing list