# cannot convert from CMap* __w64 to CMap*&

## Recommended Posts

Johnn    145
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 on other sites
Deebo    128
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 on other sites
Johnn    145
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 on other sites
ghosted    445
You need to remove the '&' from the function parameters.

void CBullet::Init(CMap *map)

Edit: dammit, too late. Never mind.

##### Share on other sites
Deebo    128
Are you getting the error at this line: m_bullets->Init(&m_map);

##### Share on other sites
Johnn    145
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 on other sites
Johnn    145
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! :)

Deebo    128
No problem.