Re: error: template with C linkage

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

 



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.)

Contrary to what some people seem to believe, extern "C" does NOT mean
the compiler is compiling "in C mode" or treating the source code as C
code, it means it's compiling C++ code with C language linkage i.e.
the symbols will be named such that they can be easily called from C
programs because the symbols names will not be mangled.


[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