Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problems calling Methods that are part of DirectX

Started by Chedder May 14, 2005 at 9:56 PM 8 replies 1.7k views
Original Post
Chedder
Chedder
Alright, I finally have my compiler(Microsoft's free Visual C++ compiler) working and it builds windows applications perfectly. The problem occurs with DirectX specifically when calling functions of the IDirect3D9 class. I included d3d9.h and linked d3d9.lib and the following code works, compiles and links fine: IDirect3D9* d3d_ptr; D3DDISPLAYMODE d3dDM; if( (d3d_ptr = Direct3DCreate9(D3D_SDK_VERSION)) ==NULL) //error However, when attempting to call functions with d3d_ptr, such as GetAdapterDisplayMode the compiler says: error C2039: 'GetAdapterDisplayMode': is not a member of 'IDirect3D9' C:\DX9\Include\d3d9.h(254) : See declaration of 'IDirect3D9' The code in my source file is: if( FAILED(d3d_ptr->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3dDM))) My first notion was that GetAdapterDisplayMode was not a function of IDirect3D9; however, according to all of microsoft's documenation and other sources I have found it should be. I am completely stumped!?? Thanks for the help
Maega
Maega
Are there any errors before that?
Chedder
Chedder
Nope, Thats the only problem
Maega
Maega
Not sure if it'll make a huge difference, but did you link with dxguid.lib or define INITGUID?
Chedder
Chedder
I linked dxguid.lib and am not quite sure what to define INITGUID as but added the line

#include //found this set up on some random website?
#define INITGUID
#include
Chedder
Chedder
and still it gives the same error
chad_420
chad_420
is d3dDM a D3DDISPLAYMODE?
Chedder
Chedder
Yup
Endurion
Endurion
Are you per chance writing this code inside a .c file (instead of .cpp)?
AFAIK DirectX has a fallback to calling macros with a faked vtable when you're using plain C.

Another reason i can think of: You didn't move the DX include/lib paths to the top.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
Chedder
Chedder
THANK YOU!!! I wasn't paying attention when I saved the files, I feel like an idiot. Thank you all

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.