Click here to Skip to main content
15,905,238 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DICOM IMAGES - WHAT IS ALPHA Pin
Dave Kreskowiak28-Mar-08 8:10
mveDave Kreskowiak28-Mar-08 8:10 
Generalaccess variable from another file Pin
ptr_Electron28-Mar-08 2:32
ptr_Electron28-Mar-08 2:32 
GeneralRe: access variable from another file Pin
toxcct28-Mar-08 3:01
toxcct28-Mar-08 3:01 
GeneralRe: access variable from another file Pin
CPallini28-Mar-08 3:12
mveCPallini28-Mar-08 3:12 
GeneralRe: access variable from another file Pin
ptr_Electron28-Mar-08 3:54
ptr_Electron28-Mar-08 3:54 
QuestionRe: access variable from another file Pin
CPallini28-Mar-08 4:02
mveCPallini28-Mar-08 4:02 
GeneralRe: access variable from another file Pin
ptr_Electron28-Mar-08 4:08
ptr_Electron28-Mar-08 4:08 
GeneralRe: access variable from another file [modified] Pin
CPallini28-Mar-08 4:21
mveCPallini28-Mar-08 4:21 
[added]
here [^] it is explained very well.
[/added]

ptr_Electron wrote:
mainly used .h file included in most of the files
int nFuncEqu;

change to
extern int nFuncEqu;


ptr_Electron wrote:
using File1 // modiying the value in this file
extern int nFuncEqu;

change to:
int nFuncEqu;
(and you don't need to include the header file there).



ptr_Electron wrote:
using File2 // using the value in this file
extern int nFuncEqu;

if you include the header file then remove the declaration. On the other hand, if you don't include the header file, leave the declaration as it stands.


The rule for extern declarations is:

you must declare your variable as int nFuncEqu only inside one source file (i.e. .cpp) while declaring it extern int nFuncEqu in all other source files. Including the header (containing extern int nFuncEqu) is simply a shortcut for all those extern declarations.
Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke


modified on Friday, March 28, 2008 11:13 AM

GeneralRe: access variable from another file Pin
ptr_Electron28-Mar-08 5:38
ptr_Electron28-Mar-08 5:38 
QuestionRe: access variable from another file Pin
CPallini28-Mar-08 5:45
mveCPallini28-Mar-08 5:45 
GeneralRe: access variable from another file Pin
ptr_Electron28-Mar-08 6:12
ptr_Electron28-Mar-08 6:12 
GeneralRe: access variable from another file Pin
CPallini28-Mar-08 6:22
mveCPallini28-Mar-08 6:22 
GeneralRe: access variable from another file Pin
ptr_Electron1-Apr-08 22:42
ptr_Electron1-Apr-08 22:42 
GeneralRe: access variable from another file Pin
CPallini1-Apr-08 23:04
mveCPallini1-Apr-08 23:04 
GeneralRe: access variable from another file Pin
Nemanja Trifunovic28-Mar-08 4:15
Nemanja Trifunovic28-Mar-08 4:15 
GeneralRe: access variable from another file Pin
CPallini28-Mar-08 4:23
mveCPallini28-Mar-08 4:23 
GeneralRe: access variable from another file Pin
Matthew Faithfull28-Mar-08 4:50
Matthew Faithfull28-Mar-08 4:50 
GeneralRe: access variable from another file Pin
Nemanja Trifunovic28-Mar-08 5:03
Nemanja Trifunovic28-Mar-08 5:03 
GeneralRe: access variable from another file Pin
Matthew Faithfull28-Mar-08 5:20
Matthew Faithfull28-Mar-08 5:20 
GeneralRe: access variable from another file Pin
Nemanja Trifunovic28-Mar-08 7:18
Nemanja Trifunovic28-Mar-08 7:18 
GeneralRe: access variable from another file Pin
CPallini28-Mar-08 5:21
mveCPallini28-Mar-08 5:21 
GeneralRe: access variable from another file Pin
Nemanja Trifunovic28-Mar-08 7:19
Nemanja Trifunovic28-Mar-08 7:19 
GeneralRe: access variable from another file Pin
CPallini28-Mar-08 5:03
mveCPallini28-Mar-08 5:03 
JokeRe: access variable from another file Pin
Matthew Faithfull28-Mar-08 5:21
Matthew Faithfull28-Mar-08 5:21 
GeneralRe: access variable from another file Pin
CPallini28-Mar-08 5:42
mveCPallini28-Mar-08 5:42 

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.