<function> referenced from; symbol(s) not found.

Posted by jfm429 on Stack Overflow See other posts from Stack Overflow or by jfm429
Published on 2010-06-17T21:07:45Z Indexed on 2010/06/17 21:13 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about c++

Related posts about c