I have to modify a C project because I need to use, now, a C++ function.
Let's assume that I have a file called A.c:
A.c
uchar *const x;
uchar *const y;
/.../
and other files that also use these variables, let's call them B.c and C.c:
B.c
extern uchar *const x;
extern uchar *const y;
/.../
foo1(x);
bar1(y);
C.c
extern uchar *const x;
extern uchar *const y;
/.../
foo1(x);
bar1(y);
When I compile all the file with a C compiler everything work perfectly. Now I need to use some C++ function so I need to recompile everything with a C++ compiler. Here the errors:
undefined reference to `::x(void)'
undefined reference to `::y(void)'
Following the advice in the answer here, and using extern "C"
around the variable in B.c and C.c generates other errors
Some idea on how to solve this problem?