V
Vasileios Zografos
Hello,
I have a C++ program that calls a function from a C library (its the
Triangle program (http://www.cs.cmu.edu/~quake/triangle.html). The
library is passed as an object file: triangle.o
I compiled the library using the GNU C compiler (gcc) and it compiles fine.
I know compile and link my program using the GNU C++ compiler (g++) like
this:
g++ -Wall -O2 -o main main.cpp triangle.o
The function that I use from triangle.o is "triangulate". However, this
is where the linking fails (the compilation part works fine). The
linking error I get is the following:
In function `Triangulate(Matrix&, Matrix&, Matrix&)':
main.cpp.text+0x438): undefined reference to `triangulate(char*,
triangulateio*, triangulateio*, triangulateio*)'
collect2: ld returned 1 exit status
Now, I suspect it has to do something with the fact that my program is
in C++ and triangle in C, but surely this shouldn't be a problem right?
It works perfectly on Windows (VC++) and compiles and links fine (the
exact same program).
Has anyone got any information as to why this might be happening?
Any help would be greatly appreciated.
Thank you
V.Z.
I have a C++ program that calls a function from a C library (its the
Triangle program (http://www.cs.cmu.edu/~quake/triangle.html). The
library is passed as an object file: triangle.o
I compiled the library using the GNU C compiler (gcc) and it compiles fine.
I know compile and link my program using the GNU C++ compiler (g++) like
this:
g++ -Wall -O2 -o main main.cpp triangle.o
The function that I use from triangle.o is "triangulate". However, this
is where the linking fails (the compilation part works fine). The
linking error I get is the following:
In function `Triangulate(Matrix&, Matrix&, Matrix&)':
main.cpp.text+0x438): undefined reference to `triangulate(char*,
triangulateio*, triangulateio*, triangulateio*)'
collect2: ld returned 1 exit status
Now, I suspect it has to do something with the fact that my program is
in C++ and triangle in C, but surely this shouldn't be a problem right?
It works perfectly on Windows (VC++) and compiles and links fine (the
exact same program).
Has anyone got any information as to why this might be happening?
Any help would be greatly appreciated.
Thank you
V.Z.