error: template with C linkage

Jeffrey Walton noloader@gmail.com
Mon Sep 19 01:56:00 GMT 2011


On Sat, Sep 17, 2011 at 4:21 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 17 September 2011 14:23, Jeffrey Walton wrote:
>> /usr//include/cryptopp/cryptlib.h:99: error: template with C linkage
> ...
>> I've tried adding '-x c++' to force c++ in the files.
>
> That's obviously not going to help.
>
> If the compiler complains about a template, it's not compiling C,
> because there's no such thing in C.  Ditto for C linkage; everything
> in C has C linkage, so there's no concept of any other kind of
> language linkage, so no reason a C compiler would ever mention "C
> linkage".  So the compiler was already treating the files as
> containing C++ (just apparently assuming that everything in a system
> directory gets an implicit extern "C" around it.)
OK, thanks. I'm not sure what the implications of "system compiler"
are, but OpenBSD's configuration did not like those files in
/usr/include.

$ g++ -v
Reading specs from /usr/bin/../lib/gcc-lib/i386-unknown-openbsd4.9/4.2.1/specs
Target: i386-unknown-openbsd4.9
Configured with: OpenBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070719
$

Do you have any ideas why a location would make a difference?

Jeff



More information about the Gcc-help mailing list