Help


/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/Asus/Documents/NetBeansProjects/204Assignment1'
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/204assignment1.exe
make[2]: Entering directory `/cygdrive/c/Users/Asus/Documents/NetBeansProjects/204Assignment1'
mkdir -p build/Debug/Cygwin-Windows
rm -f build/Debug/Cygwin-Windows/PointTwoD.o.d
g++ -c -g -MMD -MP -MF build/Debug/Cygwin-Windows/PointTwoD.o.d -o build/Debug/Cygwin-Windows/PointTwoD.o PointTwoD.cpp
mkdir -p build/Debug/Cygwin-Windows
rm -f build/Debug/Cygwin-Windows/LocationData.o.d
g++ -c -g -MMD -MP -MF build/Debug/Cygwin-Windows/LocationData.o.d -o build/Debug/Cygwin-Windows/LocationData.o LocationData.cpp
LocationData.cpp:71:2: warning: no newline at end of file
mkdir -p build/Debug/Cygwin-Windows
rm -f build/Debug/Cygwin-Windows/MissionPlan.o.d
g++ -c -g -MMD -MP -MF build/Debug/Cygwin-Windows/MissionPlan.o.d -o build/Debug/Cygwin-Windows/MissionPlan.o MissionPlan.cpp
MissionPlan.cpp:111:2: warning: no newline at end of file
mkdir -p dist/Debug/Cygwin-Windows
g++ -o dist/Debug/Cygwin-Windows/204assignment1 build/Debug/Cygwin-Windows/PointTwoD.o build/Debug/Cygwin-Windows/LocationData.o build/Debug/Cygwin-Windows/MissionPlan.o
build/Debug/Cygwin-Windows/LocationData.o: In function `_ZN12LocationDataC2Ev':
/cygdrive/c/Users/Asus/Documents/NetBeansProjects/204Assignment1/LocationData.cpp:12: undefined reference to `vtable for LocationData'
build/Debug/Cygwin-Windows/LocationData.o: In function `_ZN12LocationDataC1Ev':
/cygdrive/c/Users/Asus/Documents/NetBeansProjects/204Assignment1/LocationData.cpp:12: undefined reference to `vtable for LocationData'
build/Debug/Cygwin-Windows/LocationData.o: In function `_ZN12LocationDataC2ESsiiff':
/cygdrive/c/Users/Asus/Documents/NetBeansProjects/204Assignment1/LocationData.cpp:20: undefined reference to `vtable for LocationData'
build/Debug/Cygwin-Windows/LocationData.o: In function `_ZN12LocationDataC1ESsiiff':
/cygdrive/c/Users/Asus/Documents/NetBeansProjects/204Assignment1/LocationData.cpp:20: undefined reference to `vtable for LocationData'
build/Debug/Cygwin-Windows/MissionPlan.o: In function `_Z41__static_initialization_and_destruction_0ii':
/cygdrive/c/Users/Asus/Documents/NetBeansProjects/204Assignment1/MissionPlan.cpp:13: undefined reference to `LocationData::~LocationData()'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/Cygwin-Windows/204assignment1.exe] Error 1
make[2]: Leaving directory `/cygdrive/c/Users/Asus/Documents/NetBeansProjects/204Assignment1'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/cygdrive/c/Users/Asus/Documents/NetBeansProjects/204Assignment1'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 6s)

can anyone tell me what is this error?
can u post the code or about what the program belongs to???????
this is my coding... it is a bit long..

mission.cpp

#include <cstdlib>
#include <iostream>
#include <cctype>
#include <cstring>
#include <sstream>
#include <fstream>
#include "LocationData.h"
#include "PointTwoD.h"

using namespace std;

PointTwoD p2d;
LocationData ld;
void menu();
void Entry();

int main(int argc, char** argv) {

menu();
}

void menu() {

int input;

cout << "****************************************************" << endl;
cout << "Welcome to Mission Plan Program" << endl;
cout << "1) Input statistic data" << endl;
cout << "2) Compute civ. index value (for all records)" << endl;
cout << "3) Print top 5 exploration destinations" << endl;
cout << "4) Print total travel distance" << endl;
cout << "5) Exit" << endl;
cout << "****************************************************" << endl << endl;
cout << "Please enter your choice:";

cin >> input;

switch (input) {
case 1:
Entry();
system("clear");
menu();
break;

case 2:

system("clear");
menu();
break;

case 3:

system("clear");
menu();
break;

case 4:

system("clear");
menu();
break;

case 5:
exit(0);
}
}

void Entry() {
int x, y, noPlanets, noMoons;
string sunType;
float aveParticulateDensity, avePlasmaDensity;
string data;

cout << "[Input statistical data]" << endl;

cout << "Please enter x-orinate: ";
cin.clear();
getline(cin, data);
x = atoi(data.c_str());

cout << "Please enter y-orinate: ";
cin.clear();
getline(cin, data);
y = atoi(data.c_str());

cout << "Please enter Sun-type: ";
cin.clear();
getline(cin, data);
sunType = data;

cout << "Please enter no of earth-like planet: ";
cin.clear();
getline(cin, data);
noPlanets = atoi(data.c_str());

cout << "Please enter no of earth-like moon: ";
cin.clear();
getline(cin, data);
noMoons = atoi(data.c_str());

cout << "Please enter ave. particulate density (%-tage) : ";
cin.clear();
getline(cin, data);
aveParticulateDensity = atof(data.c_str());

cout << "Please enter ave. plasma density (%-tage) : ";
cin.clear();
getline(cin, data);
avePlasmaDensity = atof(data.c_str());

}
LocationData.cpp

#include "LocationData.h"
#include <cctype>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cstring>
#include <cstring>
#include <cstdlib>

using namespace std;

LocationData::LocationData() {
sunType = "";
noPlanets = 0;
noMoons = 0;
aveParticulateDensity = 0.0;
avePlasmaDensity = 0.0;
}

LocationData::LocationData(string sunType, int noPlanets, int noMoons, float aveParticulateDensity, float avePlasmaDensity) {

this-> sunType = sunType;
this-> noPlanets = noPlanets;
this-> noMoons = noMoons;
this-> aveParticulateDensity = aveParticulateDensity;
this-> avePlasmaDensity = avePlasmaDensity;
}

string LocationData::getSunType() {
return sunType;
}

void LocationData::setSunType(string sunType) {
this -> sunType = sunType;
}

int LocationData::getNoPlanets() {
return noPlanets;
}

void LocationData::setNoPlanets(int noPlanets) {
this->noPlanets = noPlanets;
}

int LocationData::getNoMoons() {
return noMoons;
}

void LocationData::setNoMoons(int noMoons) {
this -> noMoons = noMoons;
}

float LocationData::getAveParticulateDensity() {
return aveParticulateDensity;
}

void LocationData::setAveParticulateDensity(float aveParticulateDensity) {
this -> aveParticulateDensity = aveParticulateDensity;
}

float LocationData::getAvePlasmaDensity() {
return avePlasmaDensity;
}

void LocationData::setAvePlasmaDensity(float avePlasmaDensity) {
this -> avePlasmaDensity = avePlasmaDensity;
}

string LocationData::toString() {

}
LocationData.h


#ifndef _LOCATIONDATA_H
#define _LOCATIONDATA_H
#include <cstring>
#include <iostream>

using namespace std;

class LocationData {
public:
LocationData();
LocationData(string, int, int, float, float);

// LocationData(const LocationData& orig);
virtual ~LocationData();

string getSunType();
void setSunType(string);

int getNoPlanets();
void setNoPlanets(int);

int getNoMoons();
void setNoMoons(int);

float getAveParticulateDensity();
void setAveParticulateDensity(float);

float getAvePlasmaDensity();
void setAvePlasmaDensity(float);

string toString();

private:
string sunType;
int noPlanets;
int noMoons;
float aveParticulateDensity;
float avePlasmaDensity;

};

#endif /* _LOCATIONDATA_H */



i will get this error when my code is like this.. anyway thanks for spending your time to take a look at my code.
Last edited on
You forgot to implement the destructor (like the errors says)
[code]This[/code] becomes This
erm im kinda new to c++... cause i self learn c++ myself through the web.. mine explaining to me what is destructor and how should i edit my code to make it no error?

thanks in advance
1
2
3
4
5
6
7
8
9
10
11
class LocationData {
public:
LocationData();
LocationData(string, int, int, float, float);

// LocationData(const LocationData& orig);
virtual ~LocationData(); // This is the destructor

...

};


Implementation:
1
2
LocationData::~LocationData() {
}


The destructor is called automatically before the according object is destroyed (delete/out of scope)

1
2
3
4
5
6
{
  LocationData ld
  ...
  // do some stuff with ld
  ...
} // here ~LocationData() is called 
omg.. thanks for your help....
Topic archived. No new replies allowed.