Link C and C++ Object File
I was write some library in C++. And now I want to link that library to my C program with gcc. It was error (undefined references). My C program cannnot see function in my library..
Could you help me ? How do I link my C++ object file to C source program ?. Thank
Sorry in my English :P
declare these functions with extern "C" in your cpp code
or use extern "C++" in the C code, if the compiler support that.
is this where ios::sync_with_stdio(); will help?
from what i understand u #inlude stido.h and #include iostream.h add stdlib.h too for the hell of it, and that function is built into C++ so that it works with C code..
as far as i know (which isn't much!) that will work
ah, the databases are friends
Assuming you are using the command line, are you handing the LIB file to the linker in the correct order ? The order in which library files are passed is important. The simplest mistake may sometimes be the eureka solution.