Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Cyberdrek

Error when creating an instance of struct.

This topic is 6610 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello again all...
typedef struct _GApp {
	LPDIRECTDRAW lpDD;                // A DirectDraw object
// 	LPDIRECT3DRM pD3DRM;              // A Direct3D RM object
	LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface
	LPDIRECTDRAWSURFACE lpDDSBack;    // DirectDraw back surface
	LPDIRECTDRAWPALETTE lpDDPal;      // Palette for primary surface
	LPDIRECTDRAWCLIPPER lpClipper;    // Clipper for windowed mode object in our scene

	BOOL bFullScreen;                // Are we in full-screen mode?
	BOOL bAnimating;                 // Has our animating begun?
	HWND ddWnd;                      // HWND of the DDraw window
} GApp, *LPGApp;

extern GApp gapp;
 
I fixed the problem I was having before now, here''s the error I''m getting: gamemain.obj : error LNK2001: unresolved external symbol "struct _GApp gapp" (?gapp@@3U_GApp@@A) main.obj : error LNK2001: unresolved external symbol "struct _GApp gapp" (?gapp@@3U_GApp@@A) Debug/theknightslair.exe : fatal error LNK1120: 1 unresolved externals Can anyone see what I''m doing wrong?? BTW: this struct is in a header file and I include the header where needed. Any help will be good.. Cyberdrek Headhunter Soft DLC Multimedia

Share this post


Link to post
Share on other sites
Advertisement
Initialize the struct ones to NULL:

GApp gapp = NULL;

Then everywhere you need to use struct, init whith:

extern GApp gapp;

This must work.

Zeblar Nagrim, Lord of Chaos

Share this post


Link to post
Share on other sites
Actually, I''m creating an instance of the struct in my main file as follow:

GApp gapp;

I call it as a global so basicly, it should work...


Cyberdrek
Headhunter Soft
DLC Multimedia

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!