Hello people,
it's been a long since last time I worked with C and C++. Is it possible to link Cpp code in C?
What I mean is this:
In basics, it comes to this...
I have two files:
Test_cpp.h
Test_cpp.cppCode:int test_cpp(int);
and main.c /*in other C project in which Test_cpp.h and Test_cpp.cpp are included*/Code:int test_cpp(int x) { return x+2; }
Is it possible to use extern keyword to make this work?Code:#include <stdio.h> #include "Test_CPP.h" int main(int argc, char *argv[]) { printf("%d", test_cpp(4)); return 0; }
Thanks