Help with struct

I'm working on a school project and they say I have to use a struct for these variables. After I create an instance of the struct I can't access the members?? Any ideas or help is appreciated!

Ps. My project format is Win32 Console Application

This is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//header file

 #ifndef GAMEWINDOW_H_INCLUDED   
#define GAMEWINDOW_H_INCLUDED   

#include "Global.h"

struct GAMEWINDOW
{  
		HWND hWnd;    
		int width, height;    
		bool windowed;

    // other game variables go here

};

#endif 


then for main in cpp file

1
2
3
4
5
6
7
8
9
10
11
12
13
#include "Global.h"

void main()
{
    //this is how I declare it
     GAMEWINDOW gamewindow;

    //what i want to do but won't allow access to it and nothing pops up when i  put the full stop
    gamewindow.width = 1024;


}



Please note global.h just contains a whole bunch of libraries and an include for the GameWindow.h
Last edited on
I made it simpler and still doesn't work, won't even build

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
27
28
29
#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>
//#include <d3dx9.h>
#include <string>
#include <tchar.h>
#include <iostream>
//#include <d3dx9math.h>
#include <stdio.h>

using namespace std;

struct abc {  

		HWND hWnd;    
		int width, height;    
		bool windowed;


    // other game variables go here

};

void main(){

	abc game;
	
}
i typed everything again and it seemed to work!? wierd
Topic archived. No new replies allowed.