I have a.c b.cpp files.
/****** a.c ******/
fun1(...)
{
..........
fun2(...); /* function present in b.cpp */
..........
}
/******* b.cpp *******/
extern "C" int fun2(...);
int fun2(...)
{
..........
}
I have compiled the code as follows:
a.o:a.c b.o
gcc -c -o a.o a.c b.o
b.o:b.cpp
g++ -c -o b.o b.cpp
But I'm getting error as undefined reference to "fun2()". Is this the correct way of compilation or do I need to change anything.?