Click here to Skip to main content
15,914,222 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCBCGPProp PushChar event not work Pin
MrKBA25-Mar-10 3:37
MrKBA25-Mar-10 3:37 
QuestionRe: CBCGPProp PushChar event not work Pin
CPallini25-Mar-10 3:51
mveCPallini25-Mar-10 3:51 
AnswerRe: CBCGPProp PushChar event not work Pin
MrKBA25-Mar-10 4:05
MrKBA25-Mar-10 4:05 
AnswerRe: CBCGPProp PushChar event not work Pin
tom groezer26-Mar-10 2:47
tom groezer26-Mar-10 2:47 
QuestionRe: CBCGPProp PushChar event not work Pin
CPallini26-Mar-10 2:55
mveCPallini26-Mar-10 2:55 
AnswerRe: CBCGPProp PushChar event not work Pin
Tim Craig26-Mar-10 8:37
Tim Craig26-Mar-10 8:37 
AnswerRe: CBCGPProp PushChar event not work Pin
Eugen Podsypalnikov25-Mar-10 3:52
Eugen Podsypalnikov25-Mar-10 3:52 
GeneralRe: CBCGPProp PushChar event not work Pin
MrKBA25-Mar-10 4:04
MrKBA25-Mar-10 4:04 
GeneralRe: CBCGPProp PushChar event not work Pin
Eugen Podsypalnikov25-Mar-10 4:12
Eugen Podsypalnikov25-Mar-10 4:12 
GeneralRe: CBCGPProp PushChar event not work Pin
MrKBA26-Mar-10 3:53
MrKBA26-Mar-10 3:53 
Questionneed vector of vectors to hold more than just a "pair" Pin
b-rad31125-Mar-10 3:34
b-rad31125-Mar-10 3:34 
AnswerRe: need vector of vectors to hold more than just a "pair" Pin
Chris Losinger25-Mar-10 3:42
professionalChris Losinger25-Mar-10 3:42 
GeneralRe: need vector of vectors to hold more than just a "pair" Pin
b-rad31125-Mar-10 3:45
b-rad31125-Mar-10 3:45 
GeneralRe: need vector of vectors to hold more than just a "pair" Pin
Chris Losinger25-Mar-10 3:58
professionalChris Losinger25-Mar-10 3:58 
GeneralRe: need vector of vectors to hold more than just a "pair" Pin
b-rad31125-Mar-10 4:00
b-rad31125-Mar-10 4:00 
AnswerRe: need vector of vectors to hold more than just a "pair" Pin
Nemanja Trifunovic25-Mar-10 5:43
Nemanja Trifunovic25-Mar-10 5:43 
QuestionCheck for validity of IP address [modified] Pin
krish_kumar25-Mar-10 2:42
krish_kumar25-Mar-10 2:42 
AnswerRe: :rose: Check for validity of IP address Pin
CPallini25-Mar-10 2:52
mveCPallini25-Mar-10 2:52 
AnswerRe: Check for validity of IP address Pin
krish_kumar25-Mar-10 2:55
krish_kumar25-Mar-10 2:55 
JokeRe: Check for validity of IP address Pin
enhzflep25-Mar-10 3:08
enhzflep25-Mar-10 3:08 
GeneralRe: Check for validity of IP address Pin
David Crow25-Mar-10 3:20
David Crow25-Mar-10 3:20 
GeneralRe: Check for validity of IP address Pin
CPallini25-Mar-10 3:48
mveCPallini25-Mar-10 3:48 
QuestionTools for reverse engineering Pin
tom groezer25-Mar-10 0:58
tom groezer25-Mar-10 0:58 
AnswerRe: Tools for reverse engineering Pin
enhzflep25-Mar-10 3:07
enhzflep25-Mar-10 3:07 
Questionerror LNK2005...already defined in .... Pin
rupeshkp72825-Mar-10 0:26
rupeshkp72825-Mar-10 0:26 
error LNK2005...already defined

While building my code in VS2008 I am getting a build error: error LNK2005...already defined in ....
1>Linking...
1>Main.obj : error LNK2005: "unsigned char * X1" (?X1@@3PAEA) already defined in BC.obj
1>Main.obj : error LNK2005: "char * X2" (?X2@@3PADA) already defined in BC.obj
1>Rs.obj : error LNK2005: "unsigned char * X1" (?X1@@3PAEA) already defined in BC.obj
1>Rs.obj : error LNK2005: "char * X2" (?X2@@3PADA) already defined in BC.obj

In my project I have three .h files:
1) Common_Definitions.h
unsigned char X1[16];
char X2[4];

struct xyz
{
UINT32 X3;
unsigned int X4[4];
long X5;
int X6;
int X7;
};


2) BC.h
3) RS.h

I have three .cpp files
1) Main.cpp
2) BC.cpp
3) RS.cpp


In Common_Definitions.h I have definitions/declarations which I want to be available in entire project, While BC.h and RS.h has corncenred variables.
I have included Common_Definitions.h in BC.h and RS.h.
#ifndef Common_Definitions_h
#define Common_Definitions_h
#include "Common_Definitions.h"
#endif

I have included BC.h and RS.h in their corresponding .cpp files.
I have included BC.h and RS.h also in Main.cpp

Now while building I get the linker error LNK2005.
How to resolve it?


Earlier when I had included Common_Definitions.h in BC.h and RS.h directly without ifndef.
#include "Common_Definitions.h"
then it was giving compilation error:
1>d:\...\common_deFINITIONS.h(18) : error C2086: 'unsigned char X1[16]' : redefinition
1> d:\...\common_deFINITIONS.h(18) : see declaration of 'X1'
1>d:\...\common_deFINITIONS.h(19) : error C2086: 'char X2[4]' : redefinition
1> d:\...\common_deFINITIONS.h(19) : see declaration of 'X2'
1>dd:\...\common_deFINITIONS.h(22) : error C2011: 'XYZ' : 'struct' type redefinition
1> d:\...\common_deFINITIONS.h(22) : see declaration of 'XYZ'

So to resolve that I have included Common_Definitions.h in BC.h and RS.h using ifndef.
#ifndef Common_Definitions_h
#define Common_Definitions_h
#include "Common_Definitions.h"
#endif
But this is leading to linker error.


Please let me know how to resolve this compiler and linker issue?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.