Re: Problems with compiling with gcc-4.3.2: no matching function/candidates are

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Miguel,

from a fast look at your code, I would say:

On Tue, Apr 21, 2009 at 05:37:13PM +0200, Miguel Lordelo wrote:
> I have an application which was compiled with gcc-3.3.3 and compiled
> fine. The thing is that when I compile with gcc-4.3.2 it give some
> error messages. Most of the error messages where related of missing
> libraries declarations (stdlib.h, memory, string.h, etc.).
> 
> Now I stocking on a problem that I could not solve, but actually I
> understand the problem, but it is stupid that it give that erro
> message:
> ../TT_TTCStream.cpp: In member function ‘void Gstvi::Components::Ttscm::TT_
> TTCStream::RcvTelecommand(unsigned char*, long unsigned int)’:
> ../TT_TTCStream.cpp:185: error: no matching function for call to
> ‘Gstvi::Components::Ttscm::TT_TTCStream_IF::ReceiveTelecommand(char*&,
> Smp::Int32)’
you try to call a Member-Function "ReceiveTelecommand" with two
parameters of type "char *" and "Smp::Int32"
> ../TT_DownUplink_IF.h:114: note: candidates are: virtual void
> Gstvi::Components::Ttscm::TT_DownUplink_IF::ReceiveTelecommand(const
> Smp::Char8*, Smp::Int32&)
The compiler finds a Member-Function in this class (which exists due to
inheritance from TT_DownUplink_IF), BUT: this Function needs to
arguments of type "const Smp::Char8*" and "Smp::Int32&"

The problem is the type-conversion:
You are calling it as:
> _TT_TTCStream_IF->ReceiveTelecommand(dataToPass, (::Smp::Int32)size);

With this line, (::Smp::Int32)size creates a temorary element of type
Smp::Int32. In C++, it is NOT allowed to create a non-constant reference
from a temporary (and "Smp::Int32&" is a non-constant reference).
So: the canditate can't be used.
Older versions of GCC used to create non-constant references from
temporaries (I believe, it was a GNU extension) - but now you have to
change your code:
Replacing 

_TT_TTCStream_IF->ReceiveTelecommand(dataToPass, (::Smp::Int32)size);

with

::Smp::Int32 tmp = (::Smp::Int32)size
_TT_TTCStream_IF->ReceiveTelecommand(dataToPass, tmp);

should do the trick.


HTH,

Axel

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux