error: ‘CGDisplayStreamUpdateGetRects’ 仅适用于 macOS 13.0 或更新版本。

huangapple go评论66阅读模式
英文:

screen_capturer_mac.mm:462:11: error: 'CGDisplayStreamUpdateGetRects' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]

问题

I am compile the chrome in macOS 13.2.1 with M1 pro chip, when I run this command, show error:

macOS 13.2.1上使用M1 Pro芯片编译Chrome时,运行此命令时出现错误:

➜  src git:(64ca7395b4) autoninja -C out/Default chrome

ninja: Entering directory out/Default' ninja: 进入目录 out/Default'

[20433/54517] OBJCXX obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o
[20433/54517] OBJCXX obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o

FAILED: obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o
FAILED: obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o

../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o.d -DDCHECK_ALWAYS_ON=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCR_XCODE_VERSION=1430 -DCR_CLANG_REVISION="llvmorg-17-init-4759-g547e3456-2" -DCOMPONENT_BUILD -DCR_LIBCXX_REVISION=049d48aa99786a2452537a5f5e3c411c741abb82 -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWEBRTC_ENABLE_PROTOBUF=1 -DWEBRTC_STRICT_FIELD_TRIALS=0 -DRTC_ENABLE_VP9 -DRTC_DAV1D_IN_INTERNAL_DECODER_FACTORY -DWEBRTC_HAVE_SCTP -DENABLE_EXTERNAL_AUTH -DHAVE_WEBRTC_VIDEO -DLOGGING_INSIDE_WEBRTC -DWEBRTC_ARCH_ARM64 -DWEBRTC_HAS_NEON -DWEBRTC_LIBRARY_IMPL -DWEBRTC_ENABLE_SYMBOL_EXPORT -DWEBRTC_ENABLE_AVX2 -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_MAC -DABSL_ALLOCATOR_NOTHROW=1 -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/webrtc_overrides -I../../third_party/webrtc -Igen/third_party/webrtc -I../../third_party/abseil-cpp -I../../third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../third_party/libyuv/include -I../../third_party/webrtc/sdk/objc -I../../third_party/webrtc/sdk/objc/base -Wall -Werror -Wextra -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wthread-safety -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-ignored-pragma-optimize -Wno-deprecated-builtins -Wno-bitfield-constant-conversion -Wno-deprecated-this-capture -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing -fstack-protector-strong -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -fcomplete-member-pointers -arch arm64 -fno-global-isel -mno-outline -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -O0 -fno-omit-frame-pointer -g2 -gdwarf-aranges -Xclang -debug-info-kind=limited -isysroot ../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -mmacos-version-min=10.13 -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang check-stack-allocated -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wexit-time-destructors -Wglobal-constructors -Wno-shadow -Wctad-maybe-unsupported -Wimplicit-retain-self -Wstrict-overflow -Wmissing-field-initializers -Wimplicit-retain-self -Wobjc-missing-property-synthesis -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=c++20 -Wno-trigraphs -fobjc-call-cxx-cdtors -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include -fvisibility-inlines-hidden -fobjc-arc -c ../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm -o obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o

../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:462:11: error: 'CGDisplayStreamUpdateGetRects' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:462:11: error: 'CGDisplayStreamUpdateGetRects' 仅在macOS 13.0或更高版本上可用 [-Werror,-Wunguarded-availability-new]

CGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &count);
CGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &count);

...

how to resolve this issue? I have read the docs https://chromium.googlesource.com/chromium/src/+/main/docs/mac_arm64.md and already add target_cpu = "arm64" in file chromium/src/out/Default/args.gn. the xcode version is Version 14.3 (14E222b). this is the args.gn file content:

如何解决此问题?我已阅读了文档https://chromium.googlesource.com/chromium/src/+/main/docs/mac_arm64.md,并已在文件`chromium/src/out/Default

英文:

I am compile the chrome in macOS 13.2.1 with M1 pro chip, when I run this command, show error:

➜  src git:(64ca7395b4) autoninja -C out/Default chrome
ninja: Entering directory `out/Default'
[20433/54517] OBJCXX obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o
FAILED: obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o.d -DDCHECK_ALWAYS_ON=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCR_XCODE_VERSION=1430 -DCR_CLANG_REVISION=\"llvmorg-17-init-4759-g547e3456-2\" -DCOMPONENT_BUILD -DCR_LIBCXX_REVISION=049d48aa99786a2452537a5f5e3c411c741abb82 -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWEBRTC_ENABLE_PROTOBUF=1 -DWEBRTC_STRICT_FIELD_TRIALS=0 -DRTC_ENABLE_VP9 -DRTC_DAV1D_IN_INTERNAL_DECODER_FACTORY -DWEBRTC_HAVE_SCTP -DENABLE_EXTERNAL_AUTH -DHAVE_WEBRTC_VIDEO -DLOGGING_INSIDE_WEBRTC -DWEBRTC_ARCH_ARM64 -DWEBRTC_HAS_NEON -DWEBRTC_LIBRARY_IMPL -DWEBRTC_ENABLE_SYMBOL_EXPORT -DWEBRTC_ENABLE_AVX2 -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_MAC -DABSL_ALLOCATOR_NOTHROW=1 -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/webrtc_overrides -I../../third_party/webrtc -Igen/third_party/webrtc -I../../third_party/abseil-cpp -I../../third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../third_party/libyuv/include -I../../third_party/webrtc/sdk/objc -I../../third_party/webrtc/sdk/objc/base  -Wall -Werror -Wextra -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wthread-safety -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-ignored-pragma-optimize -Wno-deprecated-builtins -Wno-bitfield-constant-conversion -Wno-deprecated-this-capture -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing -fstack-protector-strong -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -fcomplete-member-pointers -arch arm64 -fno-global-isel -mno-outline -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -O0 -fno-omit-frame-pointer -g2 -gdwarf-aranges -Xclang -debug-info-kind=limited -isysroot ../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -mmacos-version-min=10.13 -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang check-stack-allocated -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wexit-time-destructors -Wglobal-constructors -Wno-shadow -Wctad-maybe-unsupported -Wimplicit-retain-self -Wstrict-overflow -Wmissing-field-initializers -Wimplicit-retain-self -Wobjc-missing-property-synthesis -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=c++20 -Wno-trigraphs -fobjc-call-cxx-cdtors -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include -fvisibility-inlines-hidden -fobjc-arc -c ../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm -o obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:462:11: error: 'CGDisplayStreamUpdateGetRects' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
CGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &count);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:106:37: note: 'CGDisplayStreamUpdateGetRects' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN const CGRect * __nullable CGDisplayStreamUpdateGetRects(CGDisplayStreamUpdateRef __nullable updateRef,
^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:462:11: note: enclose 'CGDisplayStreamUpdateGetRects' in an @available check to silence this warning
CGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &count);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:472:45: error: 'kCGDisplayStreamShowCursor' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
(const void* []){kCGDisplayStreamShowCursor},
^~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:195:30: note: 'kCGDisplayStreamShowCursor' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN const CFStringRef  kCGDisplayStreamShowCursor CG_AVAILABLE_BUT_DEPRECATED(13.0, 14.0, "Please use ScreenCaptureKit API's SCStreamConfiguration showsCursor property instead");  /* CFBoolean - defaults to false */
^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:472:45: note: enclose 'kCGDisplayStreamShowCursor' in an @available check to silence this warning
(const void* []){kCGDisplayStreamShowCursor},
^~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:478:41: error: 'CGDisplayStreamCreate' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
CGDisplayStreamRef display_stream = CGDisplayStreamCreate(
^~~~~~~~~~~~~~~~~~~~~
../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:243:41: note: 'CGDisplayStreamCreate' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CGDisplayStreamRef __nullable CGDisplayStreamCreate(CGDirectDisplayID display,
^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:478:41: note: enclose 'CGDisplayStreamCreate' in an @available check to silence this warning
CGDisplayStreamRef display_stream = CGDisplayStreamCreate(
^~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:482:23: error: 'CGDisplayStreamStart' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
CGError error = CGDisplayStreamStart(display_stream);
^~~~~~~~~~~~~~~~~~~~
../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:273:19: note: 'CGDisplayStreamStart' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CGError CGDisplayStreamStart(CGDisplayStreamRef cg_nullable displayStream)
^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:482:23: note: enclose 'CGDisplayStreamStart' in an @available check to silence this warning
CGError error = CGDisplayStreamStart(display_stream);
^~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:485:35: error: 'CGDisplayStreamGetRunLoopSource' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(display_stream);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:295:41: note: 'CGDisplayStreamGetRunLoopSource' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CFRunLoopSourceRef __nullable CGDisplayStreamGetRunLoopSource(CGDisplayStreamRef cg_nullable displayStream)
^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:485:35: note: enclose 'CGDisplayStreamGetRunLoopSource' in an @available check to silence this warning
CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(display_stream);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:498:33: error: 'CGDisplayStreamGetRunLoopSource' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(stream);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:295:41: note: 'CGDisplayStreamGetRunLoopSource' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CFRunLoopSourceRef __nullable CGDisplayStreamGetRunLoopSource(CGDisplayStreamRef cg_nullable displayStream)
^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:498:33: note: enclose 'CGDisplayStreamGetRunLoopSource' in an @available check to silence this warning
CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(stream);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:500:5: error: 'CGDisplayStreamStop' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
CGDisplayStreamStop(stream);
^~~~~~~~~~~~~~~~~~~
../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:285:19: note: 'CGDisplayStreamStop' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CGError CGDisplayStreamStop(CGDisplayStreamRef cg_nullable displayStream)
^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:500:5: note: enclose 'CGDisplayStreamStop' in an @available check to silence this warning
CGDisplayStreamStop(stream);
^~~~~~~~~~~~~~~~~~~
7 errors generated.
[20444/54517] CXX obj/third_party/webrtc/modules/pacing/pacing/packet_router.o
ninja: build stopped: subcommand failed.

how to resolve this issue? I have read the docs https://chromium.googlesource.com/chromium/src/+/main/docs/mac_arm64.md and already add target_cpu = "arm64" in file chromium/src/out/Default/args.gn. the xcode version is Version 14.3 (14E222b). this is the args.gn file content:

➜  Default git:(64ca7395b4) cat args.gn
# Set build arguments here. See `gn help buildargs`.
target_cpu = "arm64"

答案1

得分: 1

我看到发布的编译器命令行中包括参数-mmacos-version-min=10.13,这意味着它想编译一个可以在MacOS 10.13(也称为“High Sierra”)或更新版本下运行的可执行文件。

这样的程序可能不合法地调用只在MacOS 13.0(也称为“Ventura”)或更新版本中可用的函数,因此会出现错误消息。

我建议你找到构建配置中指定-mmacos-version-min=10.13的位置,并将其更改为类似-mmacos-version-min=13.0;或者,如果你确实需要你的程序在High Sierra下运行,那么你需要重写代码,使其不调用不受10.13/High Sierra版本操作系统支持的任何函数。(实际上,有一种方法可以使这些函数调用有条件地进行,只有在程序在支持它们的操作系统上运行时才会调用,否则将调用其他代码路径;但我不太熟悉这个技术,所以不如试图描述它,我将提供一个Apple文档链接供你参考。)

英文:

I see that the posted compiler command-line includes the argument -mmacos-version-min=10.13, which is to say, it wants to compile an executable that can run under MacOS 10.13 (aka "High Sierra") or newer.

Such a program may not legally call a function that is only available in MacOS 13.0 (aka "Ventura") or newer, hence the error message.

I suggest that you find the location in your build-config where -mmacos-version-min=10.13 is specified, and change it to something like -mmacos-version-min=13.0 instead; or if you really do need your program to be runnable under High Sierra, then you'll need to rewrite the code so that it doesn't call any functions that aren't supported by the 10.13/High Sierra version of the OS. (Actually there is a way to make those function calls conditional, so that they only get called when the program is running on an OS that supports them, and some other codepath gets called otherwise; but I'm not very familiar with that technique so rather than try to describe it I'll just present a link to Apple's documentation for it)

答案2

得分: 1

我在macOS 13.4.1上尝试编译Chromium时遇到了相同的错误。最终,我对build/config/compiler/BUILD.gn中的默认clang编译器参数进行了小的修改,这使得编译成功完成。

链接到Chromium GitHub 镜像上的代码行:https://github.com/chromium/chromium/blob/4378d583b52c891b6429ae704bf5ecb252375997/build/config/compiler/BUILD.gn#L1742C6-L1742C6

通常情况下,修复可用性警告是值得的,但对于我的用例,我是为自己构建Chromium,而不计划将其分发给运行较早版本macOS的其他人。

英文:

I ran into the same error attempting to compile Chromium on macOS 13.4.1 today. I ended up making a small modification to the default clang compiler arguments in build/config/compiler/BUILD.gn, which allowed the build to complete successfully.

diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
--- a/build/config/compiler/BUILD.gn
--- b/build/config/compiler/BUILD.gn
@@ -1644,6 +1644,8 @@ config("default_warnings") {
        # which we no longer use. Check if it makes sense to remove
        # this as well. http://crbug.com/316352
        "-Wno-unneeded-internal-declaration",
+
+       "-Wno-unguarded-availability-new",
      ]
 
      if (!is_nacl || is_nacl_saigo) {

Link to the line on Chromium's GitHub mirror: https://github.com/chromium/chromium/blob/4378d583b52c891b6429ae704bf5ecb252375997/build/config/compiler/BUILD.gn#L1742C6-L1742C6

Normally it's worth fixing the availability warnings, but for my use case I was building Chromium for myself and not planning distribute it to others on an earlier version of macOS.

答案3

得分: 0

第一种方法是添加 gn 参数:

treat_warnings_as_errors = true;

第二种方法是:

#pragma clang diagnostic push 
#pragma clang diagnostic ignored "-Wunguarded-availability-new"

// 将你的错误代码放在这里

#pragma clang diagnostic pop
英文:

There are two methods:
The first one is add gn arg

treat_warnings_as_errors = true;

And the second one is:

#pragma clang diagnostic push 
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
// put your error code here
#pragma clang diagnostic pop

huangapple
  • 本文由 发表于 2023年4月11日 11:11:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75982140.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定