Mailinglist Archive: opensuse-packaging (183 mails)

< Previous Next >
Re: [opensuse-packaging] error: invalid conversion from 'const char*' to 'char*'
  • From: Raymond Wooninck <tittiatcoke@xxxxxxxxx>
  • Date: Mon, 1 Jun 2009 10:53:13 +0200
  • Message-id: <200906011053.17862.tittiatcoke@xxxxxxxxx>
Hi Martin,

On Monday 01 June 2009 07:40:56 Martin Vidner wrote:
in case you wonder why your C++ package build started to fail with
error: invalid conversion from 'const char*' to 'char*'

It's because glibc-2.10 has been checked in which contains stricter
prototypes for some functions. Instead of the C prototype
char *strchr(const char *, int)
we have
char *strchr(char *, int)
const char *strchr(const char *, int)

I am not that well familiar with C++ and maybe an example would work better :

If I have the following statement

char *pp = strchr(str, ';');

(str is a const char), then this one fails with the above error. But would the
following statement be the right correction :

const char *pp = strchr(str, ';');


Thanks

Raymond
--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-packaging+help@xxxxxxxxxxxx

< Previous Next >
List Navigation
Follow Ups
References