Reputation: 780
I am creating a Direct2D application and the API overview page says the first step is to create a factory... well I tried that with this function
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &factory);
but it gives the error
Error 62 error LNK2019: unresolved external symbol _D2D1CreateFactory@16 referenced in function "long __cdecl D2D1CreateFactory(enum D2D1_FACTORY_TYPE,struct _GUID const &,void * *)" (?D2D1CreateFactory@@YAJW4D2D1_FACTORY_TYPE@@ABU_GUID@@PAPAX@Z
I am calling the D2D1CreateFactory function from within the WinMain function.
This is how I initialized the factory pointer
ID2D1Factory *factory;
These are the Include and Library Directories
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86
I have experience with direct3D so I am familiar with devices and render targets, but I was under the impression that for direct2D the factory comes first so I haven't created any devices, render targets, etc...
Any help is appreciated.
Upvotes: 4
Views: 3705
Reputation: 3363
Try to add to your code this directive.
#pragma comment(lib, "d2d1.lib")
It will link d2d1.lib
to your object code.
You may use this directive to link to the other libs.
Upvotes: 8