473,395 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

LNK2005 error in visual c++ (already defined in .obj)

nabh4u
62
hi,
i am getting a link error in my program which states that some variable which i declared in my header file is already defined in the object file.

The error is like this:
error LNK2005: "struct list * first" (?first@@3PAUmylist@@A) already defined in list.obj
error LNK2005: "struct list * last" (?first@@3PAUmylist@@A) already defined in list.obj
error LNK2005: "struct list * current" (?first@@3PAUmylist@@A) already defined in list.obj


this is the declaration i am using in myheader file:

Expand|Select|Wrap|Line Numbers
  1. #ifndef LIST_H
  2. #define LIST_H
  3. # include<iostream>
  4. # include<list>
  5. # include<vector>
  6.  
  7. struct list
  8. {
  9.     int number;
  10.     list *previous;
  11.     list *next;
  12. };
  13.  
  14. vector <list *> listpointer; // Vector having the pointer to the elements of the list.
  15.  
  16. list *first; //  is the head of the list.
  17. list *last; // store the last position of the list.
  18. list *current; // for maintiaining the current position
  19.  
  20. void add_first();
  21.  
  22. #endif
what is wrong with the declaration? how can i correct it? I have to use these variables in my cpp file.
Mar 8 '07 #1
1 11931
willakawill
1,646 1GB
Hi. Perhaps if you remove the #include <list>
Mar 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jon | last post by:
Hi! I have a problem that have followed me for a long time. When linking, sometimes this link error below arises. My solution is always to remove all files in the project, throw away all...
1
by: arkam | last post by:
Hi, Here are my link errors : atlsd.lib(ATLComTime.obj) : error LNK2005: "public: __thiscall ATL::COleDateTime::COleDateTime(struct tagVARIANT const &)"...
2
by: bosse | last post by:
Hi, i have got a linker problem, i don't know how to handle; there are three projects in my workspace. In the Project called modules_common is a class called Features. In the second project...
0
by: Taran | last post by:
Hi all, I have this config.h file which has all the declarations for the vars being used in the application. There are no compilation errors but link errors for all the vars declared in this...
1
by: sethuganesh | last post by:
HI, i have ported vc++ 6.0 code to visual studio 2005. During batch build in debug mode i din't get any error.But if i build the same in release mode i am getting the following error. ...
6
by: fcvcnet | last post by:
Hi all, I defined a class, as fellows: // Segment.h #pragma once #include "MyPoint.h" enum TLSC {PARALLEL, INTERSECT, COINSIDE,INTERSECTATDIASTOLE} twolinesolutioncases;
1
by: dewi | last post by:
Dear All, I am trying to compile a C code using Visual C++. Can anyone explain how to solve it? Thank You. #include <math.h> #include <string.h> #include "RV2AJFRONT_NEW.h" #include...
9
by: dewi | last post by:
Dear All, I have several problem about VC++. I succeed to convert Simulink MATLAB to C code using Real-Time Workshop. I am trying to compile a C code using Visual C++ and found the error. Can...
1
by: patelcm22 | last post by:
Hi, I am facing following errors while building my application. Error 4 fatal error LNK1169: one or more multiply defined symbols found C:\Documents and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.