c++ - error LNK2001: unresolved external symbol _IID_IDirectDraw2 -
i work piece of legacy code uses direct draw , i'm in rather embarrassing situation. not long ago i've updated system , had adapt new situation (loading ddraw.dll) , worked fine. today explored legacy solution uses classes (files) i've changed, i'm stuck above mentioned linking error. i've checked , compared project properties , seam fine.
this code directx initialization, "troublesome" code bold.
typedef int (__stdcall *directdrawcreatefunc)(guid far* ,lpdirectdraw far* b, iunknown far* c); /* init_directx: * low-level directdraw initialization routine. */ int cdcutils::init_directx(hwnd allegro_wnd) { lpdirectdraw directdraw1; hresult hr; lpvoid temp; hinstance ddraw = loadlibrary("%windir%\system32\ddraw.dll"); if(ddraw== null) { return -1; } _ddrawlib =ddraw; directdrawcreatefunc ddfunc = (directdrawcreatefunc)getprocaddress(ddraw,"directdrawcreate"); if(ddfunc) { /* first have set directdraw1 interface... */ hr = ddfunc(null, &directdraw1, null); if (failed(hr)) return -1; } ///* first have set directdraw1 interface... */ //hr = directdrawcreate(null, &directdraw1, null); //if (failed(hr)) // return -1; //...then query directdraw2 interface //this place iid_idirectdraw2 mentioned in entire solution hr=directdraw1->queryinterface(iid_idirectdraw2, &temp); if (failed(hr)) return -1; _directdraw = (lpdirectdraw2)temp; directdraw1->release(); /* set default cooperation level */ hr = idirectdraw2_setcooperativelevel(_directdraw, allegro_wnd, ddscl_normal); if (failed(hr)) return -1; /* capabilities */ _ddcaps.dwsize = sizeof(_ddcaps); hr = idirectdraw2_getcaps(_directdraw, &_ddcaps, null); if (failed(hr)) { trace("can't driver caps\n"); return -1; } _dxhwnd=allegro_wnd; return 0; }
any ideas? why works in 1 solution , not in one? oh linker loathe thee.
did add dxguid.lib
project's linker inputs?
Comments
Post a Comment