one or more multiply defined symbols found

This is a discussion on one or more multiply defined symbols found within the C++ Programming forums, part of the General Programming Boards category; hi can anyone help me in this code: Code: std::vector <struct defGeompoint> defPoints; struct defGeompoint {double defGeompt[3]; }; class defGeometry:public ...

  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
    32,851
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 09:48 AM
  2. Trouble with Windows/DirectX programming
    By bobbelPoP in forum Windows Programming
    Replies: 16
    Last Post: 07-08-2008, 03: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, 01:36 PM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 11:03 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21