Click here to Skip to main content
15,926,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: HELP!! Include files need each other! Pin
Ryan Binns6-Apr-06 18:22
Ryan Binns6-Apr-06 18:22 
GeneralRe: HELP!! Include files need each other! Pin
John R. Shaw6-Apr-06 19:11
John R. Shaw6-Apr-06 19:11 
GeneralRe: HELP!! Include files need each other! Pin
Ryan Binns6-Apr-06 19:52
Ryan Binns6-Apr-06 19:52 
GeneralRe: HELP!! Include files need each other! Pin
John R. Shaw6-Apr-06 20:34
John R. Shaw6-Apr-06 20:34 
GeneralRe: HELP!! Include files need each other! Pin
Ryan Binns6-Apr-06 23:20
Ryan Binns6-Apr-06 23:20 
GeneralRe: HELP!! Include files need each other! Pin
Blake Miller7-Apr-06 4:21
Blake Miller7-Apr-06 4:21 
GeneralRe: HELP!! Include files need each other! Pin
Lord Kixdemp10-Apr-06 15:02
Lord Kixdemp10-Apr-06 15:02 
GeneralRe: HELP!! Include files need each other! Pin
Blake Miller11-Apr-06 4:29
Blake Miller11-Apr-06 4:29 
If you declare a variable in a header file and include that header file into more than one source file, then you will get the 'already declared' types of errors and warnings.

It is best to ONLY define the variable in a single header file and declare an instance of the variable in a single source file.

For example, your header file 'SuperDuperClass.H' would have something like this in it:

// this is the instance definition, leting oter source files know there is
// a variable g_MySuperDuperClass of type SuperDuperClass out there somewhere
extern SuperDuperClass g_MySuperDuperClass;

And a single source file somewhere in your project would have this near the top:

#include "SuperDuperClass.H"

// this is the instance declaration
SuperDuperClass g_MySuperDuperClass;



People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
GeneralRe: HELP!! Include files need each other! Pin
Lord Kixdemp11-Apr-06 16:49
Lord Kixdemp11-Apr-06 16:49 
GeneralRe: HELP!! Include files need each other! Pin
Blake Miller12-Apr-06 4:29
Blake Miller12-Apr-06 4:29 
GeneralRe: HELP!! Include files need each other! Pin
Lord Kixdemp13-Apr-06 16:21
Lord Kixdemp13-Apr-06 16:21 
Questiontype conversions Pin
arr.cpp6-Apr-06 11:20
arr.cpp6-Apr-06 11:20 
AnswerRe: type conversions Pin
Lord Kixdemp6-Apr-06 13:04
Lord Kixdemp6-Apr-06 13:04 
AnswerRe: type conversions Pin
Waldermort6-Apr-06 18:57
Waldermort6-Apr-06 18:57 
AnswerRe: type conversions Pin
normanS6-Apr-06 19:26
normanS6-Apr-06 19:26 
AnswerRe: type conversions Pin
Hamid_RT6-Apr-06 19:40
Hamid_RT6-Apr-06 19:40 
AnswerRe: type conversions Pin
toxcct6-Apr-06 21:48
toxcct6-Apr-06 21:48 
AnswerRe: type conversions Pin
abbiyr7-Apr-06 5:09
abbiyr7-Apr-06 5:09 
Questionscreen size Pin
arr.cpp6-Apr-06 10:40
arr.cpp6-Apr-06 10:40 
QuestionRe: screen size Pin
David Crow6-Apr-06 10:44
David Crow6-Apr-06 10:44 
GeneralRe: screen size Pin
arr.cpp6-Apr-06 10:56
arr.cpp6-Apr-06 10:56 
AnswerRe: screen size Pin
Graham Bradshaw6-Apr-06 13:02
Graham Bradshaw6-Apr-06 13:02 
QuestionWriting stream in MS Word document Pin
saima azeemi6-Apr-06 10:19
saima azeemi6-Apr-06 10:19 
AnswerRe: Writing stream in MS Word document Pin
Sheng Jiang 蒋晟6-Apr-06 16:08
Sheng Jiang 蒋晟6-Apr-06 16:08 
QuestionInternet/Network Programming Pin
CNewbie6-Apr-06 10:16
CNewbie6-Apr-06 10:16 

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.