help-octave
[Top][All Lists]
Advanced

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

Re: Build issues with libgnu


From: Johannes Zarl
Subject: Re: Build issues with libgnu
Date: Mon, 8 Sep 2014 15:45:19 +0200
User-agent: KMail/1.13.7 (Linux/3.10-0.bpo.3-amd64; KDE/4.8.4; x86_64; ; )

Hi again,

I think I've isolated the issue I'm having now. When I try to compile Octave 
using Intel compilers, I get errors like this:

../../libgnu/stdio.h(948): error: declaration is incompatible with previous 
"getchar" (declared at line 522 of "/usr/include/stdio.h")
  _GL_CXXALIAS_SYS (getchar, int, (void));

The problem seems to be rooted in the file liboctave/cruft/misc/f77-fcn.h, 
which includes libgnu/stdio.h. The following code triggers the error:

extern "C" {
#include <stdio.h>
}

Given that libgnu/stdio.h already declares getchar and other functions as 
"extern C", what is wrapping the #include (and therefore the namespace blocks 
inside it) in an extern C region supposed to achieve?

Is icpc incorrect in throwing an error here?

Thanks,
  Johannes



P.S.: Here is a short demonstration of the issue without libgnu:

# cat > test.cpp <<EOF
extern "C" {
#include <stdio.h>
namespace GNULIB_NAMESPACE
{   
    static int (*getchar) (void) = ::getchar;
}
}
EOF
# g++ -o test.o -c test.cpp
-> no error here
# icpc -o test.o -c test.cpp
test.cpp(5): error: declaration is incompatible with previous "getchar" 
(declared at line 522 of "/usr/include/stdio.h")
      static int (*getchar) (void) = ::getchar;
                   ^

compilation aborted for test.cpp (code 2)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]