1.

Solve : in need of debugging help?

Answer»

i'm using Microsoft Visual .Net Studio 2003
when i debug my program this comes up:




Compiling...
cylindermain.cpp
Linking...

cylindermain.obj : error LNK2005: "PUBLIC: void __thiscall circleType::setBase(double,double,double)" ([emailprotected][emailprotected]) already defined in circleType.obj

cylindermain.obj : error LNK2005: "public: double __thiscall circleType::getBaseCenterX(void)const " ([emailprotected]QBENXZ) already defined in circleType.obj

cylindermain.obj : error LNK2005: "public: double __thiscall circleType::getBaseCenterY(void)const " ([emailprotected]QBENXZ) already defined in circleType.obj

cylindermain.obj : error LNK2005: "public: double __thiscall circleType::getBaseRadius(void)const " ([emailprotected]QBENXZ) already defined in circleType.obj

cylindermain.obj : error LNK2005: "public: double __thiscall circleType::baseArea(void)const " ([emailprotected]QBENXZ) already defined in circleType.obj

cylindermain.obj : error LNK2005: "public: double __thiscall circleType::baseCircumference(void)const " ([emailprotected]QBENXZ) already defined in circleType.obj

cylindermain.obj : error LNK2005: "public: void __thiscall circleType::printBase(void)const " ([emailprotected]QBEXXZ) already defined in circleType.obj

cylindermain.obj : error LNK2005: "public: __thiscall circleType::circleType(double,double,double)" ([emailprotected]@[emailprotected]@Z) already defined in circleType.obj

cylindermain.obj : error LNK2005: "public: __thiscall circleType::~circleType(void)" ([emailprotected]@[emailprotected]) already defined in circleType.obj

cylinderType.obj : error LNK2005: "public: void __thiscall cylinderType::setCylinder(double,double,double,double)" ([emailprotected][emailprotected]) already defined in cylindermain.obj

cylinderType.obj : error LNK2005: "public: double __thiscall cylinderType::getCylinderBaseCenterX(void)const " ([emailprotected]QBENXZ) already defined in cylindermain.obj

cylinderType.obj : error LNK2005: "public: double __thiscall cylinderType::getCylinderBaseCenterY(void)const " ([emailprotected]QBENXZ) already defined in cylindermain.obj

cylinderType.obj : error LNK2005: "public: double __thiscall cylinderType::getCylinderBaseRadius(void)const " ([emailprotected]QBENXZ) already defined in cylindermain.obj

cylinderType.obj : error LNK2005: "public: double __thiscall cylinderType::getCylinderHeight(void)const " ([emailprotected]QBENXZ) already defined in cylindermain.obj

cylinderType.obj : error LNK2005: "public: double __thiscall cylinderType::CYLINDERVOLUME(void)const " ([emailprotected]QBENXZ) already defined in cylindermain.obj

cylinderType.obj : error LNK2005: "public: double __thiscall cylinderType::cylinderSurface(void)const " ([emailprotected]QBENXZ) already defined in cylindermain.obj

cylinderType.obj : error LNK2005: "public: void __thiscall cylinderType::printCylinder(void)const " ([emailprotected]QBEXXZ) already defined in cylindermain.obj

cylinderType.obj : error LNK2005: "public: __thiscall cylinderType::cylinderType(double,double,double,double)" ([emailprotected]@[emailprotected]@Z) already defined in cylindermain.obj

cylinderType.obj : error LNK2005: "public: __thiscall cylinderType::~cylinderType(void)" ([emailprotected]@[emailprotected]) already defined in cylindermain.obj

pointType.obj : error LNK2005: "public: void __thiscall pointType::setXY(double,double)" ([emailprotected][emailprotected]) already defined in cylindermain.obj

pointType.obj : error LNK2005: "public: double __thiscall pointType::getX(void)const " ([emailprotected]QBENXZ) already defined in cylindermain.obj

pointType.obj : error LNK2005: "public: double __thiscall pointType::getY(void)const " ([emailprotected]QBENXZ) already defined in cylindermain.obj

pointType.obj : error LNK2005: "public: void __thiscall pointType::printPoint(void)const " ([emailprotected]QBEXXZ) already defined in cylindermain.obj

pointType.obj : error LNK2005: "public: __thiscall pointType::pointType(double,double)" ([emailprotected]@[emailprotected]@Z) already defined in cylindermain.obj

pointType.obj : error LNK2005: "public: __thiscall pointType::~pointType(void)" ([emailprotected]@[emailprotected]) already defined in cylindermain.obj

Debug/cyl.exe : fatal error LNK1169: one or more multiply defined symbols found


how can i FIX these? pleasemight help if you give us your source code too...here they are.

Main
#include
#include
using namespace std;

#include "pointType.h"
#include "circleType.h"
#include "cylinderType.h"
#include "pointType.cpp"
#include "circleType.cpp"
#include "cylinderType.cpp"

int main()
{

pointType myPoint1; //(0,0);
pointType myPoint2(8,6);

circleType myCircle1; //(0,0,0);
circleType myCircle2(10, 7, 3);

cylinderType myCylinder1; //(0, 0, 0, 0);
cylinderType myCylinder2(1, 2, 3, 4);

// cout<< fixed << showpoint << setprecision(3);

cout << "myPoint1: ";
myPoint1.printPoint();
cout << endl;

cout << "myPoint2: ";
myPoint2.printPoint();
cout << endl;

cout << "myCircle1: ";
myCircle1.printBase();
cout << endl;
cout << "Circumference of myCircle1: " << myCircle1.baseCircumference() << endl;
cout << "Area of myCircle1: " << myCircle1.baseArea() << endl;

cout << "myCircle2: ";
myCircle2.printBase();
cout << endl;
cout << "Circumference of myCircle2: " << myCircle2.baseCircumference() << endl;
cout << "Area of myCircle2: " << myCircle2.baseArea() << endl;

cout << "myCylinder1: ";
myCylinder1.printCylinder();
cout << endl;
myCylinder1.printPoint();
cout << endl;
cout << "Surface of myCylinder1: " << myCylinder1.cylinderSurface() << endl;
cout << "VOLUME of myCylinder1: " << myCylinder1.cylinderVolume() << endl;

cout << "myCylinder2: ";
myCylinder2.printCylinder();
cout << endl;
myCylinder2.printPoint();
cout << endl;
cout << "Surface of myCylinder2: " << myCylinder2.cylinderSurface() << endl;
cout << "Volume of myCylinder2: " << myCylinder2.cylinderVolume() << endl;


cout<<"Press any key to continue...";
getch ();

}



cylinder

#include
#include "cylinderType.h"
using namespace std;

void cylinderType::setCylinder( double l, double w, double r, double h)
{
circleType::setBase(l, w, r);
if ( h &GT;= 0 ) height=h;
else height=0;
}

double cylinderType::getCylinderBaseCenterX() const
{
return pointType::getX();
}

double cylinderType::getCylinderBaseCenterY() const
{
return pointType::getY();
}

double cylinderType::getCylinderBaseRadius() const
{
return circleType::getBaseRadius();
}
double cylinderType::getCylinderHeight() const
{
return height;
}
double cylinderType::cylinderVolume() const
{
return circleType::baseArea() * height;
}

double cylinderType::cylinderSurface() const
{
return (circleType::baseCircumference() * height + 2* circleType::baseArea());
}

void cylinderType::printCylinder() const
{
printBase();
cout << "Height = " << height << endl ;
}

cylinderType::cylinderType(double l, double w, double r, double h):
circleType(l,w, r)
{
height=h;
}

cylinderType::~cylinderType()
{

}



circle

#include
#include "circleType.h"
using namespace std;

void circleType::setBase( double l, double w, double s)
{
pointType::setXY(l,w);
if ( s >= 0 ) radius=s;
else radius=0;
}

double circleType::getBaseCenterX() const
{
return pointType::getX();
}

double circleType::getBaseCenterY() const
{
return pointType::getY();
}

double circleType::getBaseRadius() const
{
return radius;
}

double circleType::baseArea() const
{
return (3.1415926535*radius*radius);
}

double circleType::baseCircumference() const
{
return 2* 3.1415926535 * radius;
}

void circleType::printBase() const
{
pointType::printPoint();
cout << "radius = " << radius << endl;
}

circleType::circleType(double l, double w, double r): pointType(l,w)
{
radius=r;
}

circleType::~circleType()
{
}


point


#include
#include "pointType.h"
using namespace std;

void pointType::setXY( double l, double w)
{
x=l;
y=w;
}

double pointType::getX() const
{
return x;
}

double pointType::getY() const
{
return y;
}

void pointType::printPoint() const
{
cout << "X = " << x << "; Y= " << y << endl;
}

pointType::pointType(double l, double w)
{
x=l;
y=w;
}

pointType::~pointType()
{
}



Discussion

No Comment Found