Skip to content

extern "C" is not fully supported. #7848

@BlueStaggo

Description

@BlueStaggo

Bug type: Language Service

Describe the bug

  • OS and Version: Windows 10 x64 1909
  • VS Code Version: 1.58.2
  • C/C++ Extension Version: 1.5.1
  • Other extensions you installed (and if the issue persists after disabling them): C++ Intellisense (still persists without it)

extern "C" blocks are ok, but using it like this:

extern "C" void doSomething();

causes an error. However, this does not always happen, especially after compiling using a Makefile.

Steps to reproduce

  1. Create a C++ header file.
  2. Create an extern "C" function, such as the one shown above.

Expected behavior
This is valid C++, so it should not be treated as an error.

Code sample and logs

  • Code sample

    • See the code above or the screenshot.
  • Configurations in c_cpp_properties.json

    • I do not have this.
  • Logs from running C/C++: Log Diagnostics from the VS Code command palette

-------- Diagnostics - 20/07/2021, 12:15:58
Version: 1.5.1
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.19041.0",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "compilerArgs": [],
    "intelliSenseMode": "windows-gcc-x64",
    "intelliSenseModeIsExplicit": true,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "compilerPathIsExplicit": true,
    "compilerPath": "g++",
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ C:\Users\####\Programming\C++\OpenGL\Tutorial\src\main.c ]:
    C:\USERS\####\PROGRAMMING\C++\OPENGL\TUTORIAL\SRC\MAIN.C
    C:\USERS\####\PROGRAMMING\C++\OPENGL\TUTORIAL\INCLUDE\CONST.H
Translation Unit Configurations:
[ C:\Users\####\Programming\C++\OpenGL\Tutorial\src\main.c ]:
    Process ID: 14200
    Memory Usage: 13 MB
    Compiler Path: C:\msys64\mingw64\bin\g++.exe
    Includes:
        C:\MSYS64\MINGW64\LIB\GCC\X86_64-W64-MINGW32\10.2.0\INCLUDE
        C:\MSYS64\MINGW64\INCLUDE
        C:\MSYS64\MINGW64\LIB\GCC\X86_64-W64-MINGW32\10.2.0\INCLUDE-FIXED
        C:\MSYS64\MINGW64\X86_64-W64-MINGW32\INCLUDE
        C:\USERS\####\PROGRAMMING\C++\OPENGL\TUTORIAL\INCLUDE
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: c17
    IntelliSense Mode: windows-gcc-x64
    Other Flags:
        --gcc
        --gnu_version=100200
Total Memory Usage: 13 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 3839

Screenshots

image

Additional context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions