1

I am very confused by the format of Xcode, and have tried to look around to by advice: "invert the flag" that shows up when we get these warnings. If someone could walk me through how to get to that page to silence this warning. I would be VERY grateful :)

LaurenFish
  • 11
  • 2

2 Answers2

4

You shouldn't use variable-length arrays. They are not a part of standard c++, and you should use a std::vector instead.

However, if you want to turn off a specific warning such as -Wvla-extension then you can explicitly suppress this warning by adding the -Wno-vla-extension flag when compiling the program.

You can add this flag to wherever you would normally put such flags in Xcode.

cigien
  • 57,834
  • 11
  • 73
  • 112
1

I propose to NOT use VLAs (variable Length Arrays) because they are out of the standard and unsafe, but if necessary, you can use

 #pragma clang diagnostic ignored "-Wwarning-name"

Replace warning-name with the warning name to silence

I assume that you are using clang, but if you are using GCC, replace clang with GCC.

Here is a link may also be help:

https://davedelong.com/blog/2018/12/15/silencing-specific-build-warnings/

Omar Ghannou
  • 557
  • 4
  • 9