Error with multiple data types in Global Variables

Hello all, I am having a peculiar problem with global variable declarations in a Win32 application. It appears, after a little experimentation, that the first global variable declared in my main .cpp file always shows the same error when the application is built (regardless of what the variable is). The error is as follows: "error: two or more data types in declaration of 'szTitle'".

1
2
3
4
5
6
7
8
9
#include <windows.h>

#define MAX_LOADSTRING 100

char szTitle[MAX_LOADSTRING] = "GoldPhoenix";   // The title bar text
char szClassName[] = "GoldPhoenixWindowsApp";   // Class name text
const int SHIP_MOVE_DELTA = 3;					/* How far each ship object will move*/
const int SHOT_MOVE_DELTA = 6;					/* How far each shot will move*/
//More variables follow... 


No matter what order the variables are declared in (and just as a note, the list of variables goes on, but I don't think listing all the variables matters too much), the same error appears. For instance, if I were to move "cons int SHIP_MOVE_DELTA = 3;" to the first variable declared, the error would read "error: two or more data types in declaration of 'SHIP_MOVE_DELTA'". This is very strange because this variable showed no error before, and then the error concerning szTitle would disappear....

Any information on how to fix this would be much appreciated. And just as one final note, the compiler I'm using is Code::Blocks v. 10.05
You probably typed something by mistake between the top of the file and the first variable declaration (can be somewhere in the included .h files as well). Look better ;-)
Well, to tell the truth, I have an included header called "Classes.h" that actually replaces the <windows.h> and begins as follows:

1
2
3
4
5
6
7
// Classes.h
// To be used for global class definitions used throughout execution
#include <windows.h>
#include "Resource.h"
#include "GoldPhoenix.h"

// Global Class defninitions.... 


The funny thing is that if I begin my main .cpp file with just #include <windows.h> the error disappears completely.... Unfortunately, after that my global class definitions aren't included, and hence obvious errors occur. Is there anything in the syntax of "Classes.h" that would allow for the original error described above to occur? Just for reference, GoldPhoenix.h is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// GoldPhoenix.h
// Values used by main.cpp
#ifndef IDC_STATIC
#define IDC_STATIC                      -1
#endif

// Static values used throughout execution
#define HP_S                            10 // Not accurate
// Todo:  Add values here for enemy HP values and powerups

// Miscellaneous values used throughout execution
#ifndef USER_TIMER_MINIMUM
#define USER_TIMER_MINIMUM              0x0000000A
#endif 


and Resource.h is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Resource.h
// Used by GoldPhoenix.rc
#define IDC_MYICON                      2
#define IDD_GOLDPHOENIX_DIALOG             102
#define IDS_APP_TITLE                   103
#define IDD_ABOUTBOX                    103
#define IDM_ABOUT                       104
#define IDM_EXIT                        105
#define IDI_GOLDPHOENIX                    107
#define IDI_SMALL                       108
#define IDB_SHIP						112
#define IDB_SHOT						113
#define IDB_SHOTM						114
#define IDB_ENEMY						115
#define IDC_GOLDPHOENIX                    109
#define IDM_CONTROL                     111
#define IDS_TOPMENU_TITLE				116
#define IDS_TOPMENU_OPT1				117
#define IDR_MAINFRAME                   128
#define IDD_DIALOG1                     129
#define IDD_CONTROL                     129
#define IDC_EDIT                        1001
#define IDC_LIST1                       1002
#define IDC_LIST                        1002
#define IDC_BUTTON2                     1004
#define IDC_CLEAR                       1004 
You know what, I rebuilt it with #include <windows.h> outside of the "Classes.h" header and it worked.... I still don't know what was going on, but it works now.... Sorry for bothering for such a simple problem...
Topic archived. No new replies allowed.