Hello,
I have a problem concerning the linking of a library built with gcc using g++. The linker error message is:
undefined reference to 'some_function(char*)'
The linking command looks like this:
g++ -Llibs -o"dev" ./src/Parameter.o -lp_io
where p_io is the library I am trying to link to my program. Since I have almost no detailed experience with linkink here is the filename of that lib:
libp_io.a
Is it possible to link a file that was built using gcc with g++? Any help, link, article or posting is appreciated!!
Thx in advance
Cherio Woltan
Hey moorecm,
thx for that cool link. Unfortunatly, I do not have the option of recompiling the C code. Is there any other way, that I can tell the linker: "Here is a gcc compiled lib, ... deal with it!".
Again any help is apreciated!
cherio Woltan
I can sort that out, since I first had the path wrong and the linker complained about it. Then I fixed it and now it only has trouble of finding that "undefined reference"...
You can link with C object files or libraries, as long as you instruct the C++ compiler to supress its name mangling to look up those symbols. The means to do that is by declaring the symbols with extern"C". See the link again for an example.