-isystem leads to code wrapped in extern "C"

Bug #1698539 reported by Pedro Kiefer on 2017-06-17
This bug affects 2 people
Affects Status Importance Assigned to Milestone
GNU ARM Embedded Toolchain

Bug Description

The toolchain fails to build c++ files correctly when using -isystem, as it treats all headers as being wrapped in `extern "C"`. Other versions of gcc (x86, linaro arm-linux, etc) handles this use case. It seems to be solved on upstreams versions of gcc, but not on this arm-none-eabi version.

I've tested it with 6-2016-q4-major, and 6-2017-q1-update.

related threads:

description: updated
summary: - -isystem leads to code wrapped in extern C
+ -isystem leads to code wrapped in extern "C"
Tejas Belagod (belagod-tejas) wrote :

Hi Pedro,

What is the symptom you're observing?


One symptom for example is, that the compiler generates errors, when it hits a template declaration: "error: template with C linkage"

Tejas Belagod (belagod-tejas) wrote :


I will need a test case to reproduce the issue.


Have a file t.cpp:

    #include "t.h"

    int main()

given t.h is in a subdirectory called test/ and looks like this:

    template < class T >
    void foo();

Compiling t.cpp with:

$ arm-none-eabi-g++ t.cpp -isystem test
In file included from t.cpp:1:0:
test/t.h:2:1: error: template with C linkage
 template < class T >

See attached the process output.

Kind regards,


Gergely Budai (gbudai76) wrote :

This is a real pain since it makes impossible to include C++ library header files with -isystem. They must be included as standard includes (-I) which makes compilation very noisy.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers