Re: problem in gcc (lib) headers __BEGIN_DECLS & traceback-incomplete

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

 



On 7 March 2017 at 21:14, L A Walsh <gcc@xxxxxxxxx> wrote:
> I have a c++ program I'm trying to get to compile which is
> showing an error in the include file chain.  First, versions:
>
>>  gcc --version
>
> gcc (SUSE Linux) 4.9.0
>>
>>  uname -a
>
> Linux Ishtar 4.10.1-Isht-Van #1 SMP PREEMPT Tue Feb 28 18:57:48 PST 2017
> x86_64 GNU/Linux
>>
>>  rpm -qf /usr/include/features.h
>
> glibc-devel-2.19-16.9.1.x86_64
>
> Invocation and output:
>
> /usr/bin/g++ -Og -g3 -ggdb -m64 -march=native -fpic -pipe -std=c++11
> -ftabstop=2 -g -DHAVE_CONFIG_H -Wp,-MD,.cpumeter.o.d
> -I/usr/include/freetype2 -I/home/tools/xosview/xosview-1.90/src
> -I/home/tools/xosview/xosview-1.90/src/linux -c cpumeter.cc -o cpumeter.o
>
> In file included from /usr/include/features.h:378:0,
>                 from /usr/include/ctype.h:25,
>                 from cpumeter.h:13,
>                 from cpumeter.cc:25:
> /usr/include/assert.h:64:1: error: expected unqualified-id before string
> constant
> __BEGIN_DECLS
> ^
> -----
>
> First part of the problem is in finding the location of the problem
> in so much as the traceback given doesn't point to assert.h.
>
> In features.h, at line 378, (starting at 375) I see:
>
> /* This is here only because every header file already includes this one.
> */
> #ifndef __ASSEMBLER__
> # ifndef _SYS_CDEFS_H
> #  include <sys/cdefs.h>
> # endif
> ----
> I.e -- no inclusion of assert.h, but instead, 378 is an inclusion of
> <sys/cdefs>.  Shouldn't the include chain have shown that file?
>
> Second part of the problem is "why the error".  I saw one or two
> other people with this error in google who's problem was
> some source error in their code before the include, but I tend
> to reject that in my case, since there isn't much before the
> includes that could cause such an error.
>
> In cpumeter.cc, there is only a comment block before the inclusion of
> cpumeter.h @ line 25 and in cpumeter.h, there are only comments
> and an include-guard (ifndef/define).  I see no code before those
> include statements.  I tried to follow the include chain, but am
> hindered by it seeming to be inaccurate or incomplete.
>
> So am sorta stuck --

Reduce your code to the minimum necessary to show the problem, and
paste that here. If as you say, there is nothing before the includes,
you shouldn't need to paste any of your code, just two files
containing nothing but include directives. We can't reliably guess
what your code does.

> Why am I getting this error, and how did I get to 'assert.h' (where
> there is a __BEGIN_CDECLS?

My guess is that either the installation of your C library headers is
messed up, or you have a header with the same name as a standard C
header, or you have a header with the same include guard as a standard
C header.



[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