I am trying to call a C function from a C++/Qt class. Basically, the C++ code gets the filename from the open file dialog, and passes it to a C function to read and parse the file. I am using g++ and gcc to compile the C++ and C code respectivly.
C header:
#ifndef READ_FILE
#define READ_FILE
int readFile( FILE* fd, int a, int b, char *data);
#endif
#ifndef READ_FILE
#define READ_FILE
int readFile( FILE* fd, int a, int b, char *data);
#endif
To copy to clipboard, switch view to plain text mode
C++ calling function just calls readFile( fd, a, b, data ) with a #include "readFile" preprocessor. I have tried putting in an extern line and prototyping the function in the C++/Qt file:
extern int readFile( FILE* fd, int a, int b, char *data);
int readFile( FILE* fd, int a, int b, char *data);
extern int readFile( FILE* fd, int a, int b, char *data);
int readFile( FILE* fd, int a, int b, char *data);
To copy to clipboard, switch view to plain text mode
However, each time I compile, I get a linker error "Undefined Reference readFile(IO_FILE, int, int, char*)". Anyone have any thoughts on what my issue is? Also, if I comment out the call to readFile in the C++/Qt, the program builds and executes (but of course does not read through the file )
Thanks!!
Bookmarks