Jump to content
  • Advertisement
Sign in to follow this  
gregpat90

passing d3d9 device to function

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

im having a problem trying to set up a utility function that initilize d3d device. i am declaring the pointer IDirect3DDevice9* in my main cpp file and trying to initlize it in utdx.cpp. im trying to passing it by refernce utdx::intdx( &g_device, g_hWnd); but nothing i do is working im getting a error Error 2 error C2664: 'IDirect3D9::CreateDevice' : cannot convert parameter 6 from 'IDirect3DDevice9 ***__w64 ' to 'IDirect3DDevice9 **'

Share this post


Link to post
Share on other sites
Advertisement
You shouldn't declare a pointer to IDirect3DDevice9* (which is a pointer-to-a-pointer to IDirect3DDevice9), it should be a pointer to IDirect3DDevice9.

In your code, the & operator is the "address-of" operator, so what you're doing is passing a pointer to a pointer to a pointer to an IDirect3DDevice 9 object.

When passing by reference, the address-of operator isn't needed, which is what's causing the error.

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!