I am trying to write a C++ code where I call a C function, lets say hello_world()
which in-turn calls a user-defined typename()
function. When I include my C code in C++, there is a compilation error, I know that typename
is a keyword in C++ but then to include C code, I'm using
extern "C" { #include "hello_world.h"}
in my C++ code, and still there is an error during compilation, any suggestions to avoid this and to compile the code, i would be grateful.
I cannot change the name of user defined typename()
function to other name. so how to go about...?
The errors as such :
In file included from New_test.cpp:19:0:
../tools/symbol.h:38:14: error: expected unqualified-id before ‘typename’
../tools/symbol.h:38:14: error: expected initializer before ‘typename’
In file included from New_test.cpp:604:0:
/usr/include/i386-linux-gnu/sys/poll.h: In function ‘int readpacket(channel*, void*, size_t)’:
/usr/include/i386-linux-gnu/sys/poll.h:48:1: error: expected unqualified-id before string constant
New_test.cpp:612:52: error: ‘poll’ was not declared in this scope