I have a piece of C code that is used from a C++ function. At the top of my C++ file I have the line:
#include "prediction.h"
In prediction.h I have this:
#ifndef prediction
#define prediction
#include "structs.h"
typedef struct {
double estimation;
double variance;
} response;
response runPrediction(int obs, location* positions, double* observations, int targets, location* targetPositions);
#endif
I also have prediction.c, which has:
#include "prediction.h"
response runPrediction(int obs, location* positions, double* observations, int targets, location* targetPositions) {
// code here
}
Now, in my C++ file (which as I said includes prediction.h) I call that function, then compile (through Xcode) I get this error:
"runPrediction(int, location*, double*, int, location*)", referenced from:
mainFrame::respondTo(char*, int)in mainFrame.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
prediction.c is marked for compilation for the current target. I don't have any problems with other .cpp files not being compiled. Any thoughts here?