Sign in to follow this  
Johnn

cannot convert from CMap* __w64 to CMap*&

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

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
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

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