Jump to content
  • Advertisement
Sign in to follow this  

error C2061: syntax error : identifier 'HINSTANCE'

This topic is 2114 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



I am refactoring a project and just after a few lines of code an error is haunting me.


Basically I configured my VS2010 project for include and lib folders for DirectX SDK June 2010, so far so good.


Now in the class where I encapsulate the device I want a function to take the HINSTANCE to create the window.

#pragma once

class Dx9Device

	void DisplayWindow(HINSTANCE hInstance, int nCmdShow, char *pInput);


But would'nt you know it, it does not take long before errors comes knocking....

dx9device.h(9): error C2061: syntax error : identifier 'HINSTANCE'


#include <windows.h>
#include <windowsx.h>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>

#include <d3d9.h>
#include <d3dx9.h>

#pragma warning(disable : 4996)
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
#pragma comment (lib, "winmm.lib")

#include "resource.h"
#include "Dx9Device.h"

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

	return 0;

What on earth am I missing?

Share this post

Link to post
Share on other sites

Right, the problem was that I did not #include Main.h where all my includes are in Dx9Device.cpp as I did in my original source. Fixed now. Thx.

Edited by Tispe

Share this post

Link to post
Share on other sites
I personally would only include other headers in my header file that are absolutely necessary. And include them again in the cpp file with addiditional includes if necessary. Then you don't have a dependency and know exactly which headers you need in which h or cpp file.

Share this post

Link to post
Share on other sites

Well, I like it simple. Even if it creates un-needed dependency. I have enough with forward declarations already.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!