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

3

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
  • 55,661
  • 11
  • 60
  • 99
0

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

 #pragma clang diagnostic ignored "-Wwarning-name"

Replace warning-name with the warning name to silence

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

Here is a link may also help:

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

Abandoned Cart
  • 3,966
  • 1
  • 31
  • 36
Omar Ghannou
  • 452
  • 4
  • 9