VS Code C extension doesn't support GCC nested functions

I edit my C code with VS Code (1.17.0) with C/C++ Extension (1.12.0) that provides error checking. I compile my code with GCC compiler that supports nested functions. So if I write this

int foo(int x)
    int bar(int x)
        return x * 2;
    return bar(x) + 1;

and compile it with gcc it works fine. However, the extension doesn’t think so and red-squiggles the second curly brace with a "semicolon expected" error. The extension allows you to choose IntelliSense mode which I set to "windows-gcc-x64", however it doesn’t seem to work. This issue exists since 2017. Is there a fix or a workaround?

>Solution :

C/C++ extension for VSCode does not support nested functions yet.

There is an issue open in their repo already, which you can track here.

… it’s been there since 2017 though

Leave a Reply