Thread: one or more multiply defined symbols found

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    78

    Smile one or more multiply defined symbols found

    hi can anyone help me in this


    code:
    Code:
    
    
    std::vector <struct defGeompoint> defPoints;
    
    struct defGeompoint
    {double defGeompt[3];
    };
    
    
    class defGeometry:public defFile{
    public: struct Section Section1,
    					  Section2,
    					  Section3,
    					  TempdefGeomSec;
    
    	std::map<std::string, tag_t> objectNameTag;
    	void populateGeometry(void);
    	static tag_t createSplineThruPoints(struct Section);
    	  Section formSection(Section Section1,Section Section2,int N1,int N2,int);
          Section  xtractPoints( Section Section1,int FromPoint,int ToPoint);
    
    };


    errors:


    error LNK2005: "class std::vector<struct defGeompoint,class std::allocator<struct defGeompoint> > defPoints" (?defPoints@@3V?$vector@UdefGeompoint@@V?$allocato r@UdefGeompoint@@@std@@@std@@A) already defined in defFile.obj


    error LNK2005: "class std::vector<struct defGeompoint,class std::allocator<struct defGeompoint> > defPoints" (?defPoints@@3V?$vector@UdefGeompoint@@V?$allocato r@UdefGeompoint@@@std@@@std@@A) already defined in defFile.obj



    fatal error LNK1169: one or more multiply defined symbols found

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > std::vector <struct defGeompoint> defPoints;
    You've got this in a header file haven't you.

    In the header file, use
    extern std::vector <struct defGeompoint> defPoints;

    In ONE .cpp file only, use
    std::vector <struct defGeompoint> defPoints;

    A better idea would be to do this without using a global variable to begin with.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Symbol file not found for *.ko
    By yanglei_fage in forum Linux Programming
    Replies: 3
    Last Post: 03-30-2009, 08:48 AM
  2. Trouble with Windows/DirectX programming
    By bobbelPoP in forum Windows Programming
    Replies: 16
    Last Post: 07-08-2008, 02:27 AM
  3. Strange error?
    By MrLucky in forum C++ Programming
    Replies: 5
    Last Post: 02-04-2006, 03:01 PM
  4. symbols, no symbols, symbols ...
    By pavmarc in forum Linux Programming
    Replies: 0
    Last Post: 08-23-2005, 12:36 PM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM