I have one file (FILE_A.cpp) with a function's body as follows:
vector<char *> lines_vector;
foo(my_file_path, "zzz", lines_vector, fout);
foo
is defined in another file (FILE_B.cpp):
void foo(char * in_file, char * keyword, vector<char *>& lines_vector, FILE * fout)
Since FILE_A.cpp uses FILE_B.cpp's function, it includes its headed, and here's the problem:
FILE_B.h has all of its function headers inside a
#ifdef __cplusplus
extern "C" {
#endif
...
void foo(char * in_file, char * keyword, vector<char *>& lines_vector, FILE * fout)
...
#ifdef __cplusplus
};
#endif
and when trying to add my function it doesn't recognize the vector. The errors given are
1) expected ',' or '...' before '<' token
2) expected initializer before '}' token
3) 'vector' has not been declared
which makes me suspect that extern C
can't parse this. Is there a problem in using cpp objects inside extern "C" {}
or is there another problem here?