2 Replies - 27416 Views - Last Post: 07 January 2013 - 12:30 PM Rate Topic: -----

#1 jthompson1294   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-December 12

DX11 Create Device Not Working

Posted 07 January 2013 - 01:50 AM

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 [email protected] 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;
}



Is This A Good Question/Topic? 0
  • +

Replies To: DX11 Create Device Not Working

#2 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1594
  • View blog
  • Posts: 5,010
  • Joined: 20-March 10

Re: DX11 Create Device Not Working

Posted 07 January 2013 - 02:52 AM

Hi

I take it you have already included

#include<D3DX11.h>

now you need to link to d3d11.lib

to do that go to project properties

Linker -> Input

In Additional Dependancies

Add d3d11.lib

This should solve the problem

Regards

Snoopy.

This post has been edited by snoopy11: 07 January 2013 - 02:52 AM

Was This Post Helpful? 1
  • +
  • -

#3 jthompson1294   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-December 12

Re: DX11 Create Device Not Working

Posted 07 January 2013 - 12:30 PM

Ah thank you, it works now. I thought the book told me all the addings I needed in the beginning of the book, but it must of forgot about the linker part, I never new about it. Thank you so much.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1