Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

DX11 Create Device Not Working

$
0
0
I am currently going through a book from Frank Luna on DirectX11 and I copied this code from his book to test it. It it using the CreateDevice function from D3D11. The code keeps giving me a linker error and I cant seem to find the problem. My Computer does not support Dx11, but I used a referenced device type in the D3D11CreateDevice, that is the only thing i changed from the books code.


Heres the error I get:
1>DX11 Ch 4.obj : error LNK2019: unresolved external symbol _D3D11CreateDevice@40 referenced in function _main
fatal error LNK1120: 1 unresolved externals

Heres the Code:

int main()
{
	UINT createDeviceFlags = 0;				        

	#if defined(DEBUG) || defined(_DEBUG)
		createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
	#endif


	HRESULT hr;                                     
	D3D_FEATURE_LEVEL Feature_Levels;              
	ID3D11Device* Device;				            
	ID3D11DeviceContext* Immidiate_Device_Context;

	hr = D3D11CreateDevice(0, 
			       D3D_DRIVER_TYPE_REFERENCE, // Using reference, device does not support dx11
			       0, 
			       createDeviceFlags, 
			       0, 0, 
			       D3D11_SDK_VERSION, 
			       &Device, 
			       &Feature_Levels, 
			       &Immidiate_Device_Context);

	if(FAILED(hr))
	{
		MessageBox(0,L"D3D11CreateDevice Failed.",0,0);
		return false;
	}

	if(Feature_Levels != D3D_FEATURE_LEVEL_11_0)
	{
		MessageBox(0, L"Direct 3D Feature 11 Not Supported", 0,0);
		return false;
	}

	return 0;
}


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>