just wanted to start some C++ and created these simple class:
Ellipsoid.h
#ifndef __Ellipsoid__Ellipsoid__
#define __Ellipsoid__Ellipsoid__
#include <iostream>
#include <cassert>
class Ellipsoid {
private:
double axisA;
double flatteningF;
public:
Ellipsoid() {};
Ellipsoid(double aIn, double fIn);
double getAxisA();
double getFlatteningF();
};
#endif /* defined(__Ellipsoid__Ellipsoid__) */
Ellipsoid.cpp
#include "Ellipsoid.h"
Ellipsoid::Ellipsoid (double aIn, double fIn) : axisA(aIn), flatteningF(fIn) {};
int main() {
std::cout << "bla";
Ellipsoid el = Ellipsoid(44.3, 32);
double test = el.getAxisA();
return 0;
}
as you can see nothing special here. i’m using xcode on osx10.8.
But when i run the programm i come to this error:
Undefined symbols for architecture x86_64:
“Ellipsoid::getAxisA()”, referenced from:
_main in Ellipsoid.o
ld: symbol(s) not found for architecture x86_64
and i really can’t figure out whats wrong. tried to set the architecture to 32 bit but this won’t work neither
The definition of the
Ellipsoid::getAxisA()function is missing. You must define somewhere. Right now you only have a declaration, not a definition. The definition could look something like this:And would live in Ellipsoid.cpp.