Jump to content
  • Advertisement
Sign in to follow this  

New to Programming-Direct X Help

This topic is 4522 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Since this is the beginners section i'd thought i'd post here.. since i couldnt find a topic anywhere on the web that could help me. How do i setup VC++ to use direct x... I've downloaded the SDK. Installed it. I have VC++ 2005 installed. using this code
Quote:
#include <windows.h> #include <d3d8.h> HWND hWnd; LPDIRECT3D8 pD3D; LPDIRECT3DDEVICE8 pDevice; LRESULT CALLBACK WndProc( HWND hWnd , UINT message , WPARAM wParam , LPARAM lParam){ switch(message){ case WM_CLOSE: PostQuitMessage(0); return 0; } return DefWindowProc(hWnd,message,wParam,lParam); } bool CreateSimpWindow(int width, int height){ // Create A Window Class Structure WNDCLASSEX wc; wc.cbClsExtra = 0; wc.cbSize = sizeof(wc); wc.cbWndExtra = 0; wc.hbrBackground = NULL; wc.hCursor = NULL; wc.hIcon = NULL; wc.hIconSm = NULL; wc.hInstance = GetModuleHandle(NULL); wc.lpfnWndProc = WndProc; wc.lpszClassName = "GFTF"; wc.lpszMenuName = NULL; wc.style = CS_VREDRAW|CS_HREDRAW|CS_OWNDC; // Register Window Class RegisterClassEx(&wc); // Create Window hWnd = CreateWindowEx(0, "GFTF", "MEh 2000", WS_OVERLAPPEDWINDOW|WS_VISIBLE, 100,100,width,height, NULL,NULL,wc.hInstance,0); return true; } bool InitD3D(){ if((pD3D = Direct3DCreate8(D3D_SDK_VERSION))==NULL){ return false; } D3DDISPLAYMODE d3ddm; pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.Windowed = true; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; if(FAILED(pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice))){ return false; } return true; } void RenderD3DScene(){ pDevice->Clear(0,NULL,D3DCLEAR_TARGET,0,1,0); pDevice->Present(NULL,NULL,NULL,NULL); } void MessageLoop(){ MSG msg; while(true){ RenderD3DScene(); if(PeekMessage(&msg,hWnd,0,0,PM_REMOVE)){ if(msg.message==WM_QUIT)return; TranslateMessage(&msg); DispatchMessage(&msg); } } } INT WINAPI WinMain( HINSTANCE , HINSTANCE , LPSTR , INT ){ if(!CreateSimpWindow(400, 400))return 1; if(!InitD3D())return 2; MessageLoop(); return 0; }
i get this error in the buildlog
Quote:
Build Log Build started: Project: D3Dx, Configuration: Debug|Win32 Command Lines Creating temporary file "c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\D3Dx\D3Dx\Debug\RSP00000852926080.rsp" with contents [ /O2 /FD /EHsc /MT /Fo"Debug\\" /Fd"Debug\vc80.pdb" /c /TP ".\main.cpp" ] Creating command line "cl.exe @"c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\D3Dx\D3Dx\Debug\RSP00000852926080.rsp" /nologo /errorReport:prompt" Output Window Compiling... main.cpp .\main.cpp(2) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory Results Build log was saved at "file://c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\D3Dx\D3Dx\Debug\BuildLog.htm" D3Dx - 1 error(s), 0 warning(s)]
What do i need to do? help.So many great ideas. So much WANT to do this. Yet i cant even start. Im pretty sure i have to link stuff... but idk what.. If anyone here knows how to setup VC++ to work with Direct X plz post [Edited by - PlaGuED on January 2, 2006 5:20:59 PM]

Share this post


Link to post
Share on other sites
Advertisement
I checked The DirectX SDK's location to where it was installed to.

C:\Program Files\Microsoft DirectX SDK (December 2005)\Include


I have no clue on how to set VC++ to work with DX.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You need the Platform SDK too. Download and install it!

Share this post


Link to post
Share on other sites
What platform SDK?

Im pretty sure when installing VC++ i got .NET 2.0 installed aswell.?


If this isnt it... where would i find it?

Share this post


Link to post
Share on other sites
"windows.h" is a part of the Platform SDK. You can download the SDK here.
Linkt
Then you need to tell VC where to find all the headers and libraries.
go to
Tools->Options->Projects and Solutions->VC++ Directories
and set all pathes if needed.

Edit:
.Net SDK is not the Platform SDK!
add these two lines to your code:
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"d3dx8.lib")

[Edited by - Kambiz on January 2, 2006 5:41:10 PM]

Share this post


Link to post
Share on other sites
If you're just getting started with programming in general, I'd definitely advise against messing with DirectX (or anything graphical).

It'll do little more than confusing the hell out of you.

But yeah, it looks like you're missing the platform SDK (it comes with the "proper" versions of Visual Studio, but not the Express ones).

If you do have it, you just need to set the proper include paths. Open project properties, and somewhere under C/C++ settings you should be able to find some settings for include path (Or you might want to just add it to the default paths for Visual Studio as a whole.)

Share this post


Link to post
Share on other sites
There is another thing I forgot to tell you about!
You need to enable the Win32 Application project type in VC++ Express 2005.
Read this: Link

Share this post


Link to post
Share on other sites
you cant deter me away from anything if i wana learn it. People have tried and failed.

Once i can start. I learn quick.

[Edited by - PlaGuED on January 2, 2006 8:53:40 PM]

Share this post


Link to post
Share on other sites
Okay. I downloaded the platform. Installed it.

I went to Tools > Options >VC++ directories > and included the Platfrom SDK into the Include/Lib/Bin/Src.


For my Project > Properties > Linker > input.

I have

d3d8.lib d3dx8.lib winmm.lib


typed in.


I this error. now tho.

Quote:
Build Log


Build started: Project: D3Dx, Configuration: Debug|Win32

Command Lines


Creating temporary file "c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\D3Dx\D3Dx\Debug\RSP0000071916320.rsp" with contents
[
/O2 /FD /EHsc /MT /Fo"Debug\\" /Fd"Debug\vc80.pdb" /c /TP ".\main.cpp"
]
Creating command line "cl.exe @"c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\D3Dx\D3Dx\Debug\RSP0000071916320.rsp" /nologo /errorReport:prompt"
Creating temporary file "c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\D3Dx\D3Dx\Debug\RSP0000081916320.rsp" with contents
[
/OUT:"C:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\D3Dx\Debug\D3Dx.exe" /MANIFEST /MANIFESTFILE:"Debug\D3Dx.exe.intermediate.manifest" d3d8.lib d3dx8.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

".\Debug\main.obj"
]
Creating command line "link.exe @"c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\D3Dx\D3Dx\Debug\RSP0000081916320.rsp" /NOLOGO /ERRORREPORT:PROMPT"

Output Window


Compiling...
main.cpp
Linking...
LINK : fatal error LNK1181: cannot open input file 'd3dx8.lib'

Results


Build log was saved at "file://c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\D3Dx\D3Dx\Debug\BuildLog.htm"
D3Dx - 1 error(s), 0 warning(s)



Also i added the pragma's to the main.cpp.


Im glad none of you are getting annoyed with me... And i apperciate your help.
This is wierd tho. since i have the DX SDK included.
Quote:
LINK : fatal error LNK1181: cannot open input file 'd3dx8.lib'

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!