Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionmultiple definition of..... Pin
krish_kumar28-Jan-10 22:02
krish_kumar28-Jan-10 22:02 
AnswerRe: multiple definition of..... Pin
CPallini28-Jan-10 22:10
mveCPallini28-Jan-10 22:10 
AnswerRe: multiple definition of..... Pin
KingsGambit28-Jan-10 22:48
KingsGambit28-Jan-10 22:48 
GeneralRe: multiple definition of..... Pin
CPallini28-Jan-10 23:05
mveCPallini28-Jan-10 23:05 
GeneralRe: multiple definition of..... Pin
KingsGambit28-Jan-10 23:32
KingsGambit28-Jan-10 23:32 
GeneralRe: multiple definition of..... Pin
David Crow30-Jan-10 5:30
David Crow30-Jan-10 5:30 
GeneralRe: multiple definition of..... Pin
KingsGambit31-Jan-10 17:58
KingsGambit31-Jan-10 17:58 
AnswerRe: multiple definition of..... Pin
Avi Berger29-Jan-10 8:07
Avi Berger29-Jan-10 8:07 
You have it backwards.

Your extern node_t *root; belongs in your .h file. It declares to anyone that includes it that there is such a variable that is created someplace and can be used.

Your node_t *root = 0; belongs in exactly one .c file and no .h file. It defines (creates) the variable. You only do this once. If you put this in a header file, than each .c file that uses that header would create a separate variable of that name. Those multiple variables of the same name which are globally visible and accessible would conflict with each other, hence the error multiple definition of `root'
Questionmember function confusion Pin
tasumisra28-Jan-10 20:10
tasumisra28-Jan-10 20:10 
AnswerRe: member function confusion Pin
Cedric Moonen28-Jan-10 20:15
Cedric Moonen28-Jan-10 20:15 
AnswerRe: member function confusion Pin
CPallini28-Jan-10 21:05
mveCPallini28-Jan-10 21:05 
AnswerRe: member function confusion Pin
Nelek28-Jan-10 21:59
protectorNelek28-Jan-10 21:59 
QuestionRe: member function confusion Pin
CPallini28-Jan-10 22:05
mveCPallini28-Jan-10 22:05 
JokeRe: member function confusion Pin
Nelek28-Jan-10 22:22
protectorNelek28-Jan-10 22:22 
GeneralRe: member function confusion Pin
CPallini28-Jan-10 22:28
mveCPallini28-Jan-10 22:28 
GeneralRe: member function confusion Pin
Nelek28-Jan-10 23:02
protectorNelek28-Jan-10 23:02 
QuestionMicrosoft Visual C++ Runtime Library! Stuck in the issue! What could b the way around? Pin
bilal haider28-Jan-10 20:02
bilal haider28-Jan-10 20:02 
AnswerRe: Microsoft Visual C++ Runtime Library! Stuck in the issue! What could b the way around? Pin
Cedric Moonen28-Jan-10 20:17
Cedric Moonen28-Jan-10 20:17 
AnswerRe: Microsoft Visual C++ Runtime Library! Stuck in the issue! What could b the way around? Pin
KarstenK28-Jan-10 23:34
mveKarstenK28-Jan-10 23:34 
QuestionVS2008 EXE not working in another machine Pin
Anu_Bala28-Jan-10 19:36
Anu_Bala28-Jan-10 19:36 
AnswerRe: VS2008 EXE not working in another machine Pin
KingsGambit28-Jan-10 20:28
KingsGambit28-Jan-10 20:28 
QuestionLoad MFC regular DLL failed Pin
machengzhi28-Jan-10 19:16
machengzhi28-Jan-10 19:16 
AnswerRe: Load MFC regular DLL failed Pin
KingsGambit28-Jan-10 19:23
KingsGambit28-Jan-10 19:23 
GeneralRe: Load MFC regular DLL failed Pin
machengzhi28-Jan-10 19:29
machengzhi28-Jan-10 19:29 
GeneralRe: Load MFC regular DLL failed Pin
KingsGambit28-Jan-10 19:34
KingsGambit28-Jan-10 19:34 

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.