Jump to content
  • Advertisement
Sign in to follow this  
Johnn

cannot convert from CMap* __w64 to CMap*&

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

I have no ideas why... it used to work but now I get this error. I've searched a bit on the __w64 keyword and it seems to have nothing to do with what Im doing. I pass the address of a CMap object m_bullets->Init(&m_map); void CBullet::Init(CMap*& map) { m_map = map; //m_map being a CMap* } Any ideas?

Share this post


Link to post
Share on other sites
Advertisement

void CBullet::Init(CMap*& map) {
m_map = map; //m_map being a CMap*
}


Here you are passing a reference to a pointer, only to copy the pointer. You should only pass references when you are using it. If all you are doing in that function is copying the pointer, it is best to remove the reference.


void CBullet::Init(CMap* map) {
m_map = map; //m_map being a CMap*
}


If you REALLY need the reference, change CBullet::m_map from CMap* to CMap*&. But then you will have to rewrite some other things in your code to accomodate for this change.

The last thing you can try is creating a temp variable.
Ex:

CMap Map;
const CMap* pMap = ⤅
m_bullets->Init(pMap);

This MIGHT help because your are referencing the temp variable created by this line of code:

m_bullets->Init(&m_map);


Well, these only a few guesses based on the info you posted. If you can be more specific with the errors you get, I can probally give a more concrete answer.

[Edited by - Deebo on November 11, 2004 8:24:13 AM]

Share this post


Link to post
Share on other sites
The actual error is "cannot convert parameter 1 from CMap* __w64 to CMap*&"

And yes, in m_bullets->Init(&m_map); m_map is an actual object.

Share this post


Link to post
Share on other sites
You need to remove the '&' from the function parameters.

void CBullet::Init(CMap *map)

instead of void CBullet::Init(CMap*& map)

Edit: dammit, too late. Never mind.

Share this post


Link to post
Share on other sites
Yes, I was.
I made it work now but when I render the map, there a big parts missing. Sometimes, it's all black with only ammo and gun boxes floating around but with collisions with the map still working... I guess the pointers to the actual map must be messing around with data...
Working on that.
Thanks for the help btw!

Share this post


Link to post
Share on other sites
Found the bug! I was changing the frustum in CBullet. So when I was drawing the map, most of the time, since the surroundings werent in the frustum, they werent getting rendered!
Thanks again all! :)

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!