Compile error current master

John Ralls jralls at ceridwen.us
Sat Apr 26 10:25:27 EDT 2014


On Apr 26, 2014, at 3:25 AM, Herbert Thoma <herbert.thoma at iis.fraunhofer.de> wrote:

> Am 26.04.2014 11:13, schrieb Geert Janssens:
>> On Saturday 26 April 2014 11:07:50 Herbert Thoma wrote:
>>> Hi,
>>> 
>>> I get the following error when I try to build the current master
>>> branch:
>>> 
>>> make[5]: Entering directory
>>> `/home/tma/gnucash/gnucash_cvs/gnucash/src/libqof/qof' /bin/sh
> <...>
>>> [-Werror] cc1plus: error: command line option '-Wmissing-prototypes'
>>> is valid for C/ObjC but not for C++ [-Werror] cc1plus: all warnings
>>> being treated as errors
>>> make[5]: *** [libgnc_qof_la-gnc-date.lo] Fehler 1
>>> make[5]: Leaving directory
>>> `/home/tma/gnucash/gnucash_cvs/gnucash/src/libqof/qof'
>>> 
>>> When did we start with C++?
>>> 
>> Yesterday.
>> 
>> John committed the first few patches to compile libqof as a c++ library.
>> 
>> But apparently there's an issue with gcc and these patches. See also bug
>> https://bugzilla.gnome.org/show_bug.cgi?id=729001
> 
> Ah I see.
> 
> BTW: if I supply --disable-error-on-warning to configure, it does not get much
> further:
> 
> kvp_frame.c: In function 'KvpFrame* get_trailer_make(KvpFrame*, const char*, char**)':
> kvp_frame.c:329:38: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
> kvp_frame.c: In function 'const KvpFrame* get_trailer_or_null(const KvpFrame*, const char*, char**)':
> kvp_frame.c:371:38: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
> make[5]: *** [libgnc_qof_la-kvp_frame.lo] Error 1
> 
> C++ is much stricter with types than plain C ...

Indeed. One of its features.

Apparently you have a defective string.h: The lines in question are
      last_key = strrchr (key_path, '/');

and strrchr is declared as
      char* strrchr(const char *, int);
in the POSIX standard [1]. 'key_frame' is the 'const char*' argument in the function arguments.

I can const_cast<char*>(key_frame) in there, but I'd rather not.

Regards,
John Ralls


[1] http://pubs.opengroup.org/onlinepubs/009695299/functions/strrchr.html 


More information about the gnucash-devel mailing list