I am facing some problems with linking the libraries in my projects. I am using qmake to generate the make files. I used the "same" pro files to generate the exectable on a mac, but when I switched to Linux64, it gives me linking error.
Basically, I have two applications : VF_Tool, and VF_UQ, that use the same libraries. I am able to build VF_UQ successfully. I am pasting below the commands that makefile is using to link the libraries.
Please note that this application depends upon the following libraries which I have compiled successfully in previous steps -
(a) libQGLViewer
(b) libVFViewer
(c) libTriMesh_VF
(d) libTriMesh_UQ
(e) libSimplify
(f) libUtils
(g) libVFV
This application depends upon
(a) libQGLViewer
(b) libTriMesh_VF
(c) libTriMesh_UQ
(d) libUtils
While VF_UQ links successfully, with the command posted in (1), VF_Tool gives the following error
../lib.Linux64/debug/libTriMesh_UQ.a(TriMesh_UQ.o): In function `TriMesh_UQ::doEdgeFlips()':
/Data/VectorFields/code/TriMesh_UQ/src/TriMesh_UQ.cc:415: undefined reference to `TriMesh::get_relativeCommonEdge(int, int) const'
/Data/VectorFields/code/TriMesh_UQ/src/TriMesh_UQ.cc:416: undefined reference to `TriMesh::get_relativeCommonEdge(int, int) const'
/Data/VectorFields/code/TriMesh_UQ/src/TriMesh_UQ.cc:425: undefined reference to `TriMesh::get_facePoints(int) const'
/Data/VectorFields/code/TriMesh_UQ/src/TriMesh_UQ.cc:426: undefined reference to `TriMesh::get_facePoints(int) const'
and more linking errors of the same kind. All the functions that the linker reports unreferenced are in the same cpp file, and should be in libTriMesh_VF.
I am confused as to why I am able to link one application successfully, while the other fails.
If libTriMesh_UQ depends on libTriMesh_VF, the the link line should specify -lTriMesh_UQ -lTriMesh_VF (in that order). The order of dependencies matters when linking.
It's possible that the VF_UQ program doesn't ever use these functions, but they are used in VF_Tool.