Am starting out in gcc/linux and am porting an application from MSVCPP6 into gcc (yes, I've finally seen the light...). I've hit a number of problems and figured them out, but this one has me stumped.
The program compiles fine, but on linking I get a ton of errors like this:
/tmp/cckguNaH.o(.gnu.linkonce.t._ZNSt4listIP11HornElementSaIS1_EEaSERKS3_+0x67): In function `std::list<HornElement*, std::allocator<HornElement*> >::operator=(std::list<HornElement*, std::allocator<HornElement*> > const&)':
: undefined reference to `int operator!=<std::_List_iterator<HornElement*, HornElement*&, HornElement**> >(std::_List_iterator<HornElement*, HornElement*&, HornElement**> const&, std::_List_iterator<HornElement*, HornElement*&, HornElement**> const&)'
(HornElement is a class in the program). All the errors refer to 'list' in some way - I'm using the STL list template. I've tried linking in with -lstdc++ and --static -lstdg++ but this makes no difference.
The application requries GALib (standard genetic algorithm library), which I'm linking to - its examples run fine, and I've checked the include/link phases with short test programs and they compile/link/build/run fine - I don't think the problem is here but thought I'd mention it. This is what the -lga command links in. (I installed and 'make'd this myself, and this is a new concept for me so it is conceivable that I got it wrong, but I don't think so as I've successfully linked things to libga.a)
Here is the build command:
g++ main.cpp -Wall -I../include -L../lib -lga -lm
(The -I and -L paths are correct and have been verified separately). I should mention that the program is spread over a number of other .h/.cpp files I wrote which are #included in main.cpp - this all compiles fine.
'g++ -v' gives:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-52)
g++ main.cpp -shared -Wall -I../include -L../lib -lga -lm
compiles and links, but on running ./a.out immediately crashes with 'Segmentation Fault''
I'm utterly stuck on this and will be very grateful for any help; I'll gladly provide any more information that I have omitted here.