000
03.12.2007, 00:00 Uhr
smeagle24
|
Linking... main.obj : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16 main.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw7 Debug/DDrawTut1.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe.
Diese Fehlermeldung erhalte ich wenn ich mein Programm linken will. Ich benutze die DX9 SDK und habe die lib-Files direkt im Projekt eingebunden. Was habe ich nur falsch gemacht.
C++: |
#include <windows.h> #include <ddraw.h>
#define WindowTitle "DirectDraw-Tutorial" #define WindowClassName "DDWinClass"
LPDIRECTDRAW7 lpDirectDraw; // DirectDraw-Objekt HRESULT ddrval;
LONG FAR WINAPI WndProc (HWND , UINT , UINT , LONG) ;
int WINAPI WinMain (HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nCmdShow) { MSG msg ; HWND hwnd ; WNDCLASS wndclass ; if (!hPrevInstance) { wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon (NULL , IDI_APPLICATION) ; wndclass.hCursor = LoadCursor (NULL , IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH)GetStockObject (LTGRAY_BRUSH) ; wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = WindowClassName ; RegisterClass (&wndclass) ; } hwnd = CreateWindow (WindowClassName , WindowTitle , WS_OVERLAPPEDWINDOW , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , NULL , NULL , hInstance , NULL) ; ShowWindow (hwnd , nCmdShow) ; UpdateWindow (hwnd) ;
ddrval = DirectDrawCreateEx(NULL, (VOID**)&lpDirectDraw, IID_IDirectDraw7, NULL); if (ddrval != DD_OK) { return (0); }
ddrval = lpDirectDraw->SetCooperativeLevel (hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); if (ddrval != DD_OK) { lpDirectDraw->Release(); lpDirectDraw = NULL; return (0); }
ddrval = lpDirectDraw->SetDisplayMode (640, 480, 8, 0, 0); if (ddrval != DD_OK) { lpDirectDraw->Release(); lpDirectDraw = NULL; return (0); }
while(1) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if (msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } }
if (lpDirectDraw != NULL) { lpDirectDraw->Release(); lpDirectDraw = NULL; }
return msg.wParam ; }
LONG FAR WINAPI WndProc (HWND hwnd , UINT message , UINT wParam , LONG lParam) { switch (message) { case WM_DESTROY: { PostQuitMessage (0) ; return 0 ; } break; } // switch (message) return DefWindowProc (hwnd , message , wParam , lParam) ; } // WndProc
|
|