Click here to Skip to main content
15,895,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ syntax: any idea to avoid overwriting functions of base class? Pin
includeh103-Apr-10 8:22
includeh103-Apr-10 8:22 
GeneralRe: C++ syntax: any idea to avoid overwriting functions of base class? PinPopular
Richard MacCutchan3-Apr-10 9:22
mveRichard MacCutchan3-Apr-10 9:22 
GeneralRe: C++ syntax: any idea to avoid overwriting functions of base class? Pin
Leif Simon Goodwin4-Apr-10 2:09
Leif Simon Goodwin4-Apr-10 2:09 
AnswerRe: C++ syntax: any idea to avoid overwriting functions of base class? Pin
Bernódus Kristinsson24-Apr-10 14:27
Bernódus Kristinsson24-Apr-10 14:27 
Questioncan't run unicode/normalize example Pin
permutations2-Apr-10 16:09
permutations2-Apr-10 16:09 
AnswerRe: can't run unicode/normalize example Pin
Adam Roderick J2-Apr-10 18:17
Adam Roderick J2-Apr-10 18:17 
QuestionRedefination error [modified] Pin
darc koder2-Apr-10 9:47
darc koder2-Apr-10 9:47 
AnswerRe: Redefination error Pin
Rick York2-Apr-10 10:18
mveRick York2-Apr-10 10:18 
There are two ways to deal with this. One is to put the word "extern" in front of the declarations in the header file and then in one and ONLY one place (main.cpp most likely) add those declarations again without the "extern" in front of them.

The second option is to do this -

In the header file :

#ifdef DECLARE_GLOBALS
#define GLOBAL
#else
#define GLOBAL extern
#endif

// define structures here ...

// now declare instances

GLOBAL circles cl;
GLOBAL polygon pg;


Then in just ONE of the .cpp files, again like main.cpp, do this :

#define DECLARE_GLOBALS
#include "shapes.h"


This scheme can work with virtually any global variables if you really need to use them.
GeneralRe: Redefination error Pin
darc koder2-Apr-10 10:40
darc koder2-Apr-10 10:40 
GeneralRe: Redefination error Pin
Rick York2-Apr-10 10:52
mveRick York2-Apr-10 10:52 
AnswerRe: Redefination error Pin
Tim Craig2-Apr-10 14:09
Tim Craig2-Apr-10 14:09 
AnswerRe: Redefination error Pin
«_Superman_»2-Apr-10 15:27
professional«_Superman_»2-Apr-10 15:27 
QuestionDuplicate Handle to get Real Process Handle Pin
ForNow2-Apr-10 8:29
ForNow2-Apr-10 8:29 
AnswerRe: Duplicate Handle to get Real Process Handle Pin
Richard MacCutchan2-Apr-10 9:30
mveRichard MacCutchan2-Apr-10 9:30 
QuestionCComboBox "right allign text" option moves the list box selection arrow to the left (VC 6.0 MFC) Pin
Vaclav_2-Apr-10 8:24
Vaclav_2-Apr-10 8:24 
AnswerRe: CComboBox "right allign text" option moves the list box selection arrow to the left (VC 6.0 MFC) Pin
Richard MacCutchan2-Apr-10 9:32
mveRichard MacCutchan2-Apr-10 9:32 
GeneralRe: CComboBox "right allign text" option moves the list box selection arrow to the left (VC 6.0 MFC) Pin
Vaclav_2-Apr-10 15:41
Vaclav_2-Apr-10 15:41 
Questionlimited user in xp Pin
Boost20102-Apr-10 6:49
Boost20102-Apr-10 6:49 
QuestionRe: limited user in xp Pin
David Crow2-Apr-10 8:01
David Crow2-Apr-10 8:01 
AnswerRe: limited user in xp Pin
Boost20102-Apr-10 8:21
Boost20102-Apr-10 8:21 
GeneralRe: limited user in xp Pin
David Crow2-Apr-10 8:24
David Crow2-Apr-10 8:24 
GeneralRe: limited user in xp Pin
Boost20102-Apr-10 8:37
Boost20102-Apr-10 8:37 
GeneralRe: limited user in xp Pin
David Crow2-Apr-10 8:40
David Crow2-Apr-10 8:40 
GeneralRe: limited user in xp Pin
Boost20102-Apr-10 8:43
Boost20102-Apr-10 8:43 
GeneralRe: limited user in xp Pin
David Crow2-Apr-10 8:46
David Crow2-Apr-10 8:46 

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.