Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: in need of debugging help  (Read 2913 times)

0 Members and 1 Guest are viewing this topic.

tj13

    Topic Starter


    Newbie
    in need of debugging help
    « on: February 07, 2009, 06:51:02 PM »
    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)" (?setBase@circleType@@QAEXNNN@Z) already defined in circleType.obj

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

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

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

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

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

    cylindermain.obj : error LNK2005: "public: void __thiscall circleType::printBase(void)const " (?printBase@circleType@@QBEXXZ) already defined in circleType.obj

    cylindermain.obj : error LNK2005: "public: __thiscall circleType::circleType(double,double,double)" (??0circleType@@QAE@NNN@Z) already defined in circleType.obj

    cylindermain.obj : error LNK2005: "public: __thiscall circleType::~circleType(void)" (??1circleType@@QAE@XZ) already defined in circleType.obj

    cylinderType.obj : error LNK2005: "public: void __thiscall cylinderType::setCylinder(double,double,double,double)" (?setCylinder@cylinderType@@QAEXNNNN@Z) already defined in cylindermain.obj

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

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

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

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

    cylinderType.obj : error LNK2005: "public: double __thiscall cylinderType::cylinderVolume(void)const " (?cylinderVolume@cylinderType@@QBENXZ) already defined in cylindermain.obj

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

    cylinderType.obj : error LNK2005: "public: void __thiscall cylinderType::printCylinder(void)const " (?printCylinder@cylinderType@@QBEXXZ) already defined in cylindermain.obj

    cylinderType.obj : error LNK2005: "public: __thiscall cylinderType::cylinderType(double,double,double,double)" (??0cylinderType@@QAE@NNNN@Z) already defined in cylindermain.obj

    cylinderType.obj : error LNK2005: "public: __thiscall cylinderType::~cylinderType(void)" (??1cylinderType@@QAE@XZ) already defined in cylindermain.obj

    pointType.obj : error LNK2005: "public: void __thiscall pointType::setXY(double,double)" (?setXY@pointType@@QAEXNN@Z) already defined in cylindermain.obj

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

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

    pointType.obj : error LNK2005: "public: void __thiscall pointType::printPoint(void)const " (?printPoint@pointType@@QBEXXZ) already defined in cylindermain.obj

    pointType.obj : error LNK2005: "public: __thiscall pointType::pointType(double,double)" (??0pointType@@QAE@NN@Z) already defined in cylindermain.obj

    pointType.obj : error LNK2005: "public: __thiscall pointType::~pointType(void)" (??1pointType@@QAE@XZ) already defined in cylindermain.obj

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


    how can i fix these? please

    Bones92



      Hopeful

    • Website Designer and Microcontroller Programmer
    • Thanked: 3
      • PIC Programming New Zealand
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: in need of debugging help
    « Reply #1 on: February 07, 2009, 07:13:24 PM »
    might help if you give us your source code too...

    tj13

      Topic Starter


      Newbie
      Re: in need of debugging help
      « Reply #2 on: February 07, 2009, 07:17:05 PM »
      here they are.

      Main
      #include <iostream>
      #include <conio.h>
      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 <iostream>
      #include "cylinderType.h"
      using namespace std;

      void cylinderType::setCylinder( double l, double w, double r, double h)
      {
           circleType::setBase(l, w, r);
           if ( h >= 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 <iostream>
      #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 <iostream>
      #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()
      {
      }