   Dev-cpp / DX9 (old topic retired)
  Dear Gamedev users,I've been looking to find a workaround to an error that has been keeping me awake behind my computer for almost three nights now. I can't find out what I'm doing wrong and I'm at the end of my last shred of endurance.I'm trying to set up DEVC++ to work with DirectX9. I used to do all my previous game related programming in MSVC but due to an installion error on my Vista system all new MSVC installations turn out to be corrupt (and yes, the installer is fine, I just seem to have a registry error somewhere which is corrupt as hell).Due to my current problem and wishing to do some more DX9 in my weeks off of collega, I reinstalled Devc++. I've had some good time with this IDE, so I figured I'd use it once more.... not.--------------------------------------------------The problem I'm facing is a linker error, namely:   [Linker error] undefined reference to `Direct3DCreate9@4' which as far as I know has to do with the d3d9.lib library.I've tried everything mentioned in the old topic regarding this (http://www.gamedev.net/community/forums/topic.asp?topic_id=329919&PageSize=25&WhichPage=2), even the MSDXSDK .lib to .a conversion (and got that working without too much trouble).I've linked all the libraries necessary in the directories and project settings.The code I'm using now is some code from an other user which worked for him under DevC++, figured I might as well use that until writing my own classes for wrapping up Direct3D rendering.Directories: (lib): http://img13.imageshack.us/i/libs.jpg/Directories: (include): http://img14.imageshack.us/i/incs.jpg/I also linked these under projects, but since I converted the lib file to .a and placed it in the compiler /lib folder it should find it anyway. That's kind of why I can't wrap my head around it.If I link the lib directly, I get a different error (Error: File truncated), but probably just the linker not understanding what I'm trying to make it do.Linker: http://img9.imageshack.us/img9/4209/linker.jpgCan someone please help me fix this error? After the holiday season I will be entering a bachelors enducation for programming and I'm feeling that if I give up at the face of a little error such as this would be a sign of weakness. I. Want. To. Learn.Code:#include <d3d9.h>#include <windows.h>#pragma comment("lib", "libd3d9.a")LPDIRECT3D9 pd3d;LPDIRECT3DDEVICE9 pd3device;HRESULT Init(HWND hwnd){pd3d = Direct3DCreate9(D3D_SDK_VERSION);D3DDISPLAYMODE d3ddm;pd3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm);D3DPRESENT_PARAMETERS d3dpp;ZeroMemory(&d3dpp,sizeof(d3dpp));d3dpp.BackBufferCount = 1;d3dpp.BackBufferFormat = d3ddm.Format;d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;d3dpp.Windowed = true;d3dpp.EnableAutoDepthStencil = true;d3dpp.AutoDepthStencilFormat = D3DFMT_D16;d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;pd3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pd3device);return S_OK;}void Render(){pd3device->Clear(0,0,D3DCLEAR_TARGET,D3DCOLOR_XRGB(255,0,0),1.0f,0);pd3device->BeginScene();pd3device->EndScene();pd3device->Present(0,0,0,0);}void Kill(){if(pd3d != 0) pd3d->Release();if(pd3device != 0) pd3device->Release();}LRESULT CALLBACK WndProc(HWND hwnd , UINT Msg, WPARAM wParam ,LPARAM lParam){switch(Msg){case WM_DESTROY:PostQuitMessage(0);break;}return DefWindowProc(hwnd,Msg,wParam,lParam);}int WINAPI WinMain(HINSTANCE hInstance ,HINSTANCE hPrevInstance , LPSTR lpCmdLine, int nCmdShow){MSG Msg;bool done;WNDCLASSEX wc = { sizeof(WNDCLASSEX),CS_HREDRAW|CS_VREDRAW,WndProc,0,0,hInstance,0,0,(HBRUSH)GetStockObject(0),0,"Class",0};RegisterClassEx(&wc);HWND hwnd = CreateWindow("Class","My Window",WS_OVERLAPPEDWINDOW,0,0,800,600,0,0,hInstance,0);ShowWindow(hwnd,SW_SHOW);UpdateWindow(hwnd);Init(hwnd);Render();while(!done){if(PeekMessage(&Msg,0,0,0,PM_REMOVE)){if(Msg.message == WM_QUIT){done = true;}else{TranslateMessage(&Msg);DispatchMessage(&Msg);}}}return (int)Msg.wParam;}
  Don't use dev-cpp. It is old, out dated, and not being updated.The best IDE/compiler combo for Windows is Visual Studio. You can download the VC++ Express version for free on Microsoft's website. If you want something cross platform then consider Eclipse or Code::Blocks with the g++ compiler.Asking people to help you troubleshoot when you're using an outdated IDE and compiler isn't going to get you anywhere.   ;Quote:Original post by zer0wolfThe best IDE/compiler combo for Windows is Visual Studio. You can download the VC++ Express version for free on Microsoft's website. If you want something cross platform then consider Eclipse or Code::Blocks with the g++ compiler.Also, if your installation of Visual Studio is corrupted, I would suggest you fix that before you develop your own software. After all, if your installation of Visual Studio is corrupted, there's no saying what other things might be corrupted as well and affecting your ability to develop high-quality software.   ;Quote:Original post by zer0wolfThe best IDE/compiler combo for Windows is Visual Studio. You can download the VC++ Express version for free on Microsoft's website. If you want something cross platform then consider Eclipse or Code::Blocks with the g++ compiler.The same error happens to me when using Code::Blocks, I actually tried that one out as well.;  How does the corruption manifest itself? Do you think that it causes the linker error?In any case, it is highly beneficial that your development machine is stable. If all else fails, re-install the OS before continuing with other work. Be sure to take backups before that. And use VS2K8.   ;  I allways use DevCpp with directX devpaks without problems!!give a try.   ;Quote:Original post by monchitoI allways use DevCpp with directX devpaks without problems!!give a try.No - really don't. There's absolutely nothing that DevCpp can do that Visual Studio can't do 10 time better.   ;Quote:Original post by Evil SteveQuote:Original post by monchitoI allways use DevCpp with directX devpaks without problems!!give a try.No - really don't. There's absolutely nothing that DevCpp can do that Visual Studio can't do 10 time better.Agreed! Even the most diehard Dev-cpp users like, Johnathan Harbour, finally stopped using it and that was years ago!I remember him detailing all the workarounds and the last DirectX SDK that he was able to get to work with it on his forums, so if you insist you might be able to find that info there.