public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* invalid conversion from const char** to char**
@ 2007-06-15 10:49 Dhiraj.Nilange
  2007-06-15 14:03 ` me22
  0 siblings, 1 reply; 3+ messages in thread
From: Dhiraj.Nilange @ 2007-06-15 10:49 UTC (permalink / raw)
  To: gcc-help

Hi,

I am using g++ 4.1.1. on Linux (AMD-64-bit).

In a C++ code  I have a function whose prototype is given below:-

void fun(const char *var[]);

And I am passing the variable to this function defined as:-

const char **vname;

so the call goes as:-    fun(vname);

But I get compile time error for this:-

invalid conversion from const char** to char**

this code perfectly worked on other platforms using different conmpilers
(Windows,HP-UX,AIX etc). Only with Linux/g++ combination I get this
issue.

Please suggest some solution.

Thanks & Regards,
-Dhiraj

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: invalid conversion from const char** to char**
  2007-06-15 10:49 invalid conversion from const char** to char** Dhiraj.Nilange
@ 2007-06-15 14:03 ` me22
  2007-06-15 14:34   ` Tim Prince
  0 siblings, 1 reply; 3+ messages in thread
From: me22 @ 2007-06-15 14:03 UTC (permalink / raw)
  To: Dhiraj.Nilange; +Cc: gcc-help

On 15/06/07, Dhiraj.Nilange@iflexsolutions.com
<Dhiraj.Nilange@iflexsolutions.com> wrote:
> void fun(const char *var[]);
> const char **vname;
>
> so the call goes as:-    fun(vname);
>
> But I get compile time error for this:-
> invalid conversion from const char** to char**
>
I don't think we can solve this one without more information.

void fun(char const *var[]) {}
int main() {
    char const **vname;
    fun(vname);
}

Compiles cleanly with -ansi -pedantic.

Make sure nothing is defining away const, or something similar.

~ Scott

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: invalid conversion from const char** to char**
  2007-06-15 14:03 ` me22
@ 2007-06-15 14:34   ` Tim Prince
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Prince @ 2007-06-15 14:34 UTC (permalink / raw)
  To: me22; +Cc: Dhiraj.Nilange, gcc-help

me22 wrote:
> On 15/06/07, Dhiraj.Nilange@iflexsolutions.com
> <Dhiraj.Nilange@iflexsolutions.com> wrote:
>> void fun(const char *var[]);
>> const char **vname;
>>
>> so the call goes as:-    fun(vname);
>>
>> But I get compile time error for this:-
>> invalid conversion from const char** to char**
>>
> I don't think we can solve this one without more information.
>
But OP could use the full information which was withheld to find the 
incorrect header or similar problem which leads to the complaint.  This 
is a common problem with legacy code, which was not diagnosed by gcc 
until recently (at least not by default).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-15 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-15 10:49 invalid conversion from const char** to char** Dhiraj.Nilange
2007-06-15 14:03 ` me22
2007-06-15 14:34   ` Tim Prince

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).