g++ help

Damien Elmes resolve at repose.cx
Wed Apr 3 00:41:09 EST 2002


"Alfred" <alfred at mazuma.net.au> writes:

> I am at a loose end here :)
> I am getting this error from g++:
> ../Src/SteamValidateUserIDTickets.cpp:1533: no matching function for call to
> `ExtractNext (u8 *,
> unsigned int, u8 *&, u8 *&)'
> ../../../Common/Network/SocketHelperFunctions.h:408: candidates are: void
> common::ExtractNext (u8 *,
> const u8 *&, const u8 *)
> ../../../Common/Network/SocketHelperFunctions.h:419:                 void
> common::ExtractNext (u16 *,
> const u8 *&, const u8 *)
> ../../../Common/Network/SocketHelperFunctions.h:437:                 void
> common::ExtractNext (u32 *,
> const u8 *&, const u8 *)
> ../../../Common/Network/SocketHelperFunctions.h:459:                 void
> common::ExtractNext (u8 *,
> unsigned int, const u8 *&, const u8 *)
>
> Why, oh why, can't g++ (2.96) match the function call to the last function?
> Surely it can do the type conversion. What am I doing/thinking wrong?

C++ differs from C in that it won't convert types for you under normal
circumstances. This is done to prevent one from shooting themselves in the foot
(though there's plenty of other opportunities to do that. :-). 

My C++ is very rusty, but you should be able to resolve it by casting the
arguments as const. I suspect if this compiled elsewhere then it was a more
tolerant compiler (that's not necessarily a good thing, however).

-- 
Damien Elmes




More information about the linux mailing list