Hmm, I'm still having problems:
I'm using Dev-Cpp in which I have created C project with the following files:
Header Test_Cpp.h:
Code:
#ifndef TEST_CPP_H
#define TEST_CPP_H
extern "C" int test_cpp(int);
#endif
Implementation file Test_Cpp.cpp:
Code:
#include "Test_Cpp.h"
int test_cpp(int x)
{
return x+2;
}
Main.c:
Code:
#include <stdio.h>
#include "Test_Cpp.h"
int main()
{
printf("%d", test_cpp(4));
return 0;
}
I'm getting this error on second line:
3 C:\Dev-Cpp\C_Cpp_Dev\Test_Cpp.h syntax error before string constant
What is the possible reason for this? It's like compiler doesn't recognize extern keyword...
P.S. Test_Cpp.cpp is already compiled with C++ compiler.