R
Rahul
Hi Everyone,
I want to invoke a c function ( object file created by cc ) from a
cpp function ( object file is created using g++ ). When i try to link,
both the object files using g++
g++ cfile.o cppfile.o
i get an error saying,
: undefined reference to `fun()'
collect2: ld returned 1 exit status
Note that the fun() is the c function defined in cfile.c. I can't use
cc to link both the object files as the master file is a cpp source
file.
Is there anyway to get this done? I know the method of using extern
"C" but that works only when a cpp function ( object file created in g+
+ ) is to be invoked from a c function ( object file created in cc ).
Thanks in advance ! ! !
I want to invoke a c function ( object file created by cc ) from a
cpp function ( object file is created using g++ ). When i try to link,
both the object files using g++
g++ cfile.o cppfile.o
i get an error saying,
: undefined reference to `fun()'
collect2: ld returned 1 exit status
Note that the fun() is the c function defined in cfile.c. I can't use
cc to link both the object files as the master file is a cpp source
file.
Is there anyway to get this done? I know the method of using extern
"C" but that works only when a cpp function ( object file created in g+
+ ) is to be invoked from a c function ( object file created in cc ).
Thanks in advance ! ! !