I get an error, when I try to compile my code with Xcode. You can see the error here:
Undefined symbols for architecture x86_64:
"Sun::Datum2JDatum(Sun::Time)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems for me, that he doesn't see my Sun-File. In my opinion, I included everything. But I don't find the problem. Can someone tell me what I did wrong?
This is my main.cpp: I included all libraries that I need plus my Sun.hpp.
#include <iostream>
#include <time.h>
#include "Sun.hpp"
using namespace std;
int main(int argc, const char * argv[]) {
struct tm* timeinfo;
static char buf[200];
time_t now = time(NULL);
timeinfo = localtime(&now);
Sun::Sun sunposition;
Sun::Time time;
// ...
Sun::JDatum datum = sunposition.Datum2JDatum(time); // Here I got the Error
return 0;
}
Sun.hpp:
class Sun{
public:
typedef struct{
double jd;
double jd0;
double T;
double T0;
} JDatum;
Coordinates Locationdetermination(Sun::JDatum, Sun::Location);
JDatum Datum2JDatum(Sun::Time);
};
Sun.cpp:
Also in Sun.cpp is the Sun.hpp included.
#include "Sun.hpp"
using namespace std;
Sun::JDatum Datum2JDatum(Sun::Time Now){
//...
}
I can't find actually the mistake. It would be nice, if you would help me to solve the problem.