Hello i have come here to this forum to ask for help as i have run into a problem while writing a program.
I have a class who is supposed to update the simulation with a declaration of two instances of a data type class called vektor. When the linker arrives to the update class's constructor, GCC give the following error messages:
undefined reference to `vektor::vektor()'
undefined reference to `vektor::vektor()'
undefined reference to `vektor::vektor()'
undefined reference to `vektor::vektor()'
undefined reference to `vektor::vektor()'
What is wrong?
If i comment out "vektor ForceNy;" and "vektor ForceNy;" in UpdateSim and all references to them in the update function it compiles.
Here are the relevant parts of UpdateSim and vektor.
Code:class UpdateSim { public: UpdateSim(); ~UpdateSim(); int update(); __int64 SimTime; //How long time has the simulation simulated private: //Temp variabler till updaterings functionen vektor ForceNy; //The newly calculated force, is going to be added to Fres of the curent object vektor ForceNy; //Temporary variable distance used in calculations long double G; //The gravitational constant. unsigned int Tids_steg; //Hur lång tid går det för varje uppdatering i sekunder }; UpdateSim::UpdateSim() { //Initialize Simulation variabels G=1064407456253852709838460.8053915; Tids_steg=3600; SimTime=0; }You have to excuse that i comment my code with a mix of Swedish and English.Code:class vektor { public: //Defult Constructor vektor(); //Constructor from 4 cordinats vektor(long double sX, long double sY, long double eX, long double eY); //Constructor from 2 cordinats a magnitude and a heading vektor(long double sX, long double sY, long double Mag, float Hed); //Destructorn ~vektor(); //Negering vektor& operator-(); //Tilldelning vektor operator=(vektor const& envek); //Jämförelser bool operator!=(vektor const& envek); bool operator==(vektor const& envek); bool operator<(vektor const& envek); bool operator>(vektor const& envek); bool operator<=(vektor const& envek); bool operator>=(vektor const& envek); //Operatorer vektor operator+(vektor const& envek); vektor operator-(vektor const& envek); vektor operator*(long double const& tal); vektor operator/(long double const& tal); // vektor operator%(long double const& tal); //Return funktioner long double retStartX() { return startX; }; long double retStartY() { return startY; }; long double retEndX() { return endX; }; long double retEndY() { return endY; }; long double retMag() { return Magnetude; }; float retHed() { return Heading; }; private: long double startX, startY, endX, endY, Magnetude; float Heading; void updateHedOMag(); void updateeXOeY(); void fixavinkel(); };



LinkBack URL
About LinkBacks


