[galib] linker error when including ga.h (or GA1DArrayGenome.h)
Aaron Hoover
ahoover at eecs.berkeley.edu
Sat Apr 21 18:17:35 EDT 2007
Hi all,
I'm get the following error in my code when I include the ga.h or the
GA1DArrayGenome.h file:
/usr/bin/ld: Undefined symbols:
int operator==<OpenMesh::EdgeHandle>(OpenMesh::EdgeHandle const&,
OpenMesh::EdgeHandle const&)
int operator==<OpenMesh::FaceHandle>(OpenMesh::FaceHandle const&,
OpenMesh::FaceHandle const&)
int operator==<OpenMesh::VertexHandle>(OpenMesh::VertexHandle const&,
OpenMesh::VertexHandle const&)
int operator==<OpenMesh::HalfedgeHandle>(OpenMesh::HalfedgeHandle
const&, OpenMesh::HalfedgeHandle const&)
int operator!=<OpenMesh::HalfedgeHandle>(OpenMesh::HalfedgeHandle
const&, OpenMesh::HalfedgeHandle const&)
collect2: ld returned 1 exit status
The problem seems to be related to how templates are instantiated.
The OpenMesh::EdgeHandle data structure is a template that inherits
from a standard vector, and of course doesn't have (or need to have)
an int operator== defined for it. It seems that somehow the
GA1DArrayGenome (or some other template in ga.h) has overridden that
operator, but now the linker is looking for definitions of that
operator in other templates.
A couple of other things I should mention: I am team developing with
someone who uses VC++ 7.0 (I'm using XCode/gcc/g++ toolchain on a
mac) and he does not get this error compiling the same exact code.
This is leading me to suspect that it has something to do with how VC+
+ compiler hands automatic template instantiation as compared to gcc/g
++ and ld. Therefore, I'm hoping this can be fixed with a simple
compiler flag, but I don't know what that flag should be. Using -fno-
implicit-templates created a lot of other errors because it's very
difficult for me to know all the templates that will be necessary and
instantiate them manually.
Any help anyone can offer, is greatly appreciated.
Thanks,
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20070421/5ad753b8/attachment.htm
More information about the galib
mailing list