Hello,
I want to build a component which needs both C++ and C files, however, I encountered some problem when I compiling them together. Here's the error:
libc.lib.so: undefined reference to `Libc::Component::construct(Libc::Env&)'
collect2: error: ld returned 1 exit status
For brief, in the C++ file (main.cc ), I would use a function in the C file , so I want to compile them together.
In the main.cc file ,I add " extern "C" { # include cfile.h } " . In the cfile.h there exist the C function declaration ,let's say " fun() " , and I would use fun() in the main.cc.
And in the target.mk, I set SRC_C = xx.c xxx.c (all the C files to be used ) and add LIBS+= libc to use C library which the fun() function would use. And I get the error message above, so my question is how can I compile the C++ and the C files together?
Any help will be greatful, thanks in advance!