Click here to Skip to main content
15,901,373 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: fprint problem Pin
toxcct24-May-05 21:50
toxcct24-May-05 21:50 
GeneralRe: fprint problem Pin
26-May-05 3:41
suss26-May-05 3:41 
GeneralRe: fprint problem Pin
toxcct26-May-05 4:22
toxcct26-May-05 4:22 
GeneralRe: fprint problem Pin
Andrew Admire26-May-05 4:29
Andrew Admire26-May-05 4:29 
GeneralSkinned apps in Windows Pin
vanne24-May-05 8:07
vanne24-May-05 8:07 
GeneralRe: Skinned apps in Windows Pin
Tom Archer24-May-05 8:48
Tom Archer24-May-05 8:48 
GeneralRe: Skinned apps in Windows Pin
marstxj17-Aug-05 3:17
marstxj17-Aug-05 3:17 
Generalpc interface with usb Pin
vikas makhija24-May-05 7:47
vikas makhija24-May-05 7:47 
GeneralRe: pc interface with usb Pin
Jaime Olivares25-May-05 11:14
Jaime Olivares25-May-05 11:14 
GeneralSocket Programming Pin
Identity Undisclosed24-May-05 7:39
Identity Undisclosed24-May-05 7:39 
GeneralRe: Socket Programming Pin
Michael Hendrickx24-May-05 8:05
Michael Hendrickx24-May-05 8:05 
GeneralRe: Socket Programming Pin
Identity Undisclosed25-May-05 0:01
Identity Undisclosed25-May-05 0:01 
GeneralRe: Socket Programming Pin
Michael Hendrickx30-May-05 8:57
Michael Hendrickx30-May-05 8:57 
GeneralRe: Socket Programming Pin
Identity Undisclosed30-May-05 9:21
Identity Undisclosed30-May-05 9:21 
GeneralRe: Socket Programming Pin
Michael Hendrickx12-Jun-05 7:35
Michael Hendrickx12-Jun-05 7:35 
Generalin Win32 (SDK)color After Printing getting too much li Pin
chachva24-May-05 5:54
chachva24-May-05 5:54 
Generalvariable problem Pin
Anonymous24-May-05 5:50
Anonymous24-May-05 5:50 
GeneralRe: variable problem Pin
jmkhael24-May-05 6:00
jmkhael24-May-05 6:00 
GeneralRe: variable problem Pin
Anonymous24-May-05 6:13
Anonymous24-May-05 6:13 
GeneralRe: variable problem Pin
David Crow24-May-05 6:17
David Crow24-May-05 6:17 
GeneralRe: variable problem Pin
jmkhael24-May-05 6:18
jmkhael24-May-05 6:18 
GeneralRe: variable problem Pin
Anonymous24-May-05 6:24
Anonymous24-May-05 6:24 
GeneralRe: variable problem Pin
Bob Stanneveld24-May-05 7:18
Bob Stanneveld24-May-05 7:18 
Anonymous wrote:
// global variables:
static char boardc[BOARD_SIZE][BOARD_SIZE];
static char turn;
static int kep_row, kep_col;
static int black_eaten, white_eaten;
static int step_num, last_step_num;
static bool remove_dead_chess;
static bool count;
static float black_land, white_land;
static struct step_record step[MAX_STEP+1];


This is wrong!
I believe that you want one variable that is shared among all the components of your application. The current situation is that each object file (component) has its own copy of the variable. So if you execute the following statement in GoApp.cpp:turn = (char)100 the change is only seen in GoApp.cpp, so in GoView.cpp, the variable turn is still undefined!

Try the following instead:
<br />
// Go.cpp<br />
// global variables:<br />
char boardc[BOARD_SIZE][BOARD_SIZE];<br />
char turn;<br />
extern int kep_row, kep_col;<br />
extern int black_eaten, white_eaten;<br />
extern int step_num, last_step_num;<br />
extern bool remove_dead_chess;<br />
extern bool count;<br />
extern float black_land, white_land;<br />
extern struct step_record step[MAX_STEP+1];<br />

<br />
// Go.h<br />
// global variables:<br />
extern char boardc[BOARD_SIZE][BOARD_SIZE];<br />
extern char turn;<br />
int kep_row, kep_col;<br />
int black_eaten, white_eaten;<br />
int step_num, last_step_num;<br />
bool remove_dead_chess;<br />
bool count;<br />
float black_land, white_land;<br />
struct step_record step[MAX_STEP+1];<br />


This way, the value of the variables is the always the same in every component..

Blog[^]
Generalplease help with my attempt to edit subitem of CListCtrl Pin
lucy24-May-05 5:48
lucy24-May-05 5:48 
GeneralRe: please help with my attempt to edit subitem of CListCtrl Pin
lucy24-May-05 9:15
lucy24-May-05 9:15 

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.