Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading