I mean ,I am so lazy I even dont put "extern C { } ", linker flag in my source files when I mix them. (Which is one of the problems I guess).
I was just about to post that was the problem here. If you want to use a C function from C++, you need to have it declared extern "C" (while compiling C++). The usual way to do this is to write headers like this:
#ifndef HEADERNAME_H
#define HEADERNAME_H
/* Some #includes here perhaps */
#ifdef __cplusplus
extern "C" {
#endif
/* C declarations here */
#ifdef __cplusplus
}
#endif
#endif // HEADERNAME_H
If you don't do this, the C++ compiler will create a call to the mangled name of the function instead of to the "C name". Since the function is actually compiled with a C compiler, it'll generate the function with the unmangled C name. Which means the linker will be looking for the function under the wrong name.