Jump to content
  • Advertisement
Sign in to follow this  
infernosnow

InitDirect3D error

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

error C2660: 'initDirect3D' : function does not take 0 arguments And here's the code: www.flashxsite.com/all.rtf (open in wordpad) The background image code and fullscreen code are color-coded because I'm trying to organize the code to learn it better. ALl of the code is from sample tutorials I have that came on a CD with a DirectX book I bought/ One was fullscreen code and the other was background image code. I tried to combine them into one cpp file, but I get that error now, so I'm not sure what the problem is. It's unlikely that I accidentaly left some code out while extracting the bits of code to make full screen and a BG image appear when combining them into one .cpp file. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Line 24: bool initDirect3D(HWND hwnd);

That's forward declaring the initDirect3D() function as taking a HWND parameter, because that's the first time the C++ compiler has seen the "initDirect3D" name.

The second time the compiler sees the initDirect3D function is the call to it on line 45 in the WinMain function. The compiler looks at how initDirect3D has been declared (or forward declared) based on what it's seen so far - and that call differs from the declaration, thus the error.


Solutions:

#1 forward declare initDirect3D() as bool initDirect3D(); on line 24 so that the forward declaration matches the actual function and calls.

or

#2 move the initDirect3D() function so that it's BEFORE the first use in WinMain (so that the compiler sees the version which takes no parameters before it's first used).

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!