Sign in to follow this  

Problems calling Methods that are part of DirectX

This topic is 4594 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

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

Share this post


Link to post
Share on other sites
I linked dxguid.lib and am not quite sure what to define INITGUID as but added the line

#include <objbase.h> //found this set up on some random website?
#define INITGUID
#include <initguid.h>

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4594 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this