Click here to Skip to main content
15,903,030 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Crash without assert- and access-violation-message Pin
Prakash Nadar23-Feb-04 1:42
Prakash Nadar23-Feb-04 1:42 
General_beginthread PROBLEM Pin
Caoimh22-Feb-04 23:54
Caoimh22-Feb-04 23:54 
GeneralRe: _beginthread PROBLEM Pin
Balkrishna Talele23-Feb-04 0:03
Balkrishna Talele23-Feb-04 0:03 
GeneralRe: _beginthread PROBLEM Pin
Prakash Nadar23-Feb-04 0:03
Prakash Nadar23-Feb-04 0:03 
GeneralHEADER FILE PROBLEM Pin
Caoimh22-Feb-04 23:14
Caoimh22-Feb-04 23:14 
GeneralRe: HEADER FILE PROBLEM Pin
_Magnus_22-Feb-04 23:17
_Magnus_22-Feb-04 23:17 
GeneralRe: HEADER FILE PROBLEM Pin
Balkrishna Talele22-Feb-04 23:52
Balkrishna Talele22-Feb-04 23:52 
GeneralRe: HEADER FILE PROBLEM Pin
Prakash Nadar23-Feb-04 0:11
Prakash Nadar23-Feb-04 0:11 
We normally dont define a variable in the header file as the header file is included in many cpp files, it causes redefination of the variable.

Instead we define the variable in a .cpp file or .c file and an extern in the .h file.

In windows application developed using the project wizard, it creates two files namely stdafx.h and stdafx.cpp
stdafx is by default included in each file that you add using the classwizard.

and stdafx.cpp is generally a empty file except for #include "stdafx.h"

So the best thing is to put the defination of the variable in the stdafx.cpp file and extern in stdafx.h file

forexample

in stdafx.cpp file

#include "stdafx.h"
int g_SomeGlobalVariable;

and in stdafx.h file

extern int g_SomeGlobalVariable;

hope this solves ur problem.



1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
GeneralRe: HEADER FILE PROBLEM Pin
Caoimh23-Feb-04 1:42
Caoimh23-Feb-04 1:42 
GeneralRandom numbers Pin
amit sebiz22-Feb-04 23:14
amit sebiz22-Feb-04 23:14 
GeneralRe: Random numbers Pin
Elmar Weber22-Feb-04 23:33
Elmar Weber22-Feb-04 23:33 
GeneralRe: Random numbers Pin
Prakash Nadar23-Feb-04 0:12
Prakash Nadar23-Feb-04 0:12 
GeneralRe: Random numbers Pin
Elmar Weber23-Feb-04 0:35
Elmar Weber23-Feb-04 0:35 
GeneralRe: Random numbers Pin
amit sebiz23-Feb-04 2:18
amit sebiz23-Feb-04 2:18 
GeneralEDIT BOX PROBLEMS Pin
Caoimh22-Feb-04 23:06
Caoimh22-Feb-04 23:06 
GeneralRe: EDIT BOX PROBLEMS Pin
Prakash Nadar23-Feb-04 0:15
Prakash Nadar23-Feb-04 0:15 
GeneralMacros in Windowsx.h Pin
JGStanier22-Feb-04 23:02
JGStanier22-Feb-04 23:02 
GeneralRe: Macros in Windowsx.h Pin
Prakash Nadar23-Feb-04 0:22
Prakash Nadar23-Feb-04 0:22 
Generalneed help in connecting VC++ with Oracle Pin
alex30322-Feb-04 23:01
alex30322-Feb-04 23:01 
GeneralMFC Serialization Pin
Neha22-Feb-04 22:28
Neha22-Feb-04 22:28 
GeneralRe: MFC Serialization Pin
Selvam R23-Feb-04 0:25
professionalSelvam R23-Feb-04 0:25 
GeneralRe: MFC Serialization Pin
Prakash Nadar23-Feb-04 0:31
Prakash Nadar23-Feb-04 0:31 
QuestionIs there any Tree control that shows the expansion of the nodes horizontally ? Pin
Gem22-Feb-04 22:20
Gem22-Feb-04 22:20 
AnswerRe: Is there any Tree control that shows the expansion of the nodes horizontally ? Pin
Prakash Nadar23-Feb-04 0:33
Prakash Nadar23-Feb-04 0:33 
GeneralAUTOCAD in Visual C++ Pin
Anonymous22-Feb-04 21:58
Anonymous22-Feb-04 21:58 

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.