I have wrote this basic C program:
int main(int argc, char const *argv[])
{
int n = rand();
int a[n];
return a[0];
}
Which is getting compiled properly in gcc. But MS C/C++ intellisense in showing error squiggles stating expression must have a constant value C/C++(28) [4, 8]
. After some googling I have found out that MSVC have not implemented VLAs. But I am unable to find a way to suppress this error. Someone please help me out!
EDIT: Also, surprisingly it is not warning for implicit declaration of rand
in line 3 !!!
EDIT: If possible, can someone also mention an alternative extension for C/C++.
EDIT: I am using:
- Microsoft VSCode v1.63.2 code editor
- Microsoft C/C++ Extension Pack v1.1.10 extension
- MinGW-W64 gcc v8.1.0 compiler
GCC no compilation flags are set.
C/C++ extension is configured with following:
- compilerPath:
C:\Program Files\mingw-w64\mingw64\bin\gcc.exe
- cppStandard: gnu++20
- cStandard: gnu17
- intelliSenseMode:
windows-gcc-x64