gpt4 book ai didi

android - cocos2d-x-2.1.4 : error: format not a string literal and no format arguments [-Werror=format-security]

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:32:26 26 4
gpt4 key购买 nike

我正在 cocos2d-x-2.1.4 上开发游戏,但是,当我尝试在 Android 上构建它时,它失败并出现错误:格式不是字符串文字且没有格式参数 [-Werror=format-安全] 在文件 CCCommon.cpp 上

但是,当我检查进攻线时,它完全没问题。当我使用 Visual Studio 和 XCode 为 WIN32 和 iOS 构建文件时,该文件也构建得很好并且一直很好。

错误日志如下:

C:/Development/External/cocos2d-2.1rc0-x-2.1.3/projects/Game_C2DX213/proj.android/../../..//cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLog(char const*, ...)':
/cygdrive/c/eclipse/android-ndk-r9/build/core/build-binary.mk:348: recipe for target `obj/local/armeabi/objs/cocos2dx_static/platform/android/CCCommon.o' failed
C:/Development/External/cocos2d-2.1rc0-x-2.1.3/projects/Game_C2DX213/proj.android/../../..//cocos2dx/platform/android/CCCommon.cpp:44:72: error: format not a string literal and no format arguments [-Werror=format-security]
C:/Development/External/cocos2d-2.1rc0-x-2.1.3/projects/Game_C2DX213/proj.android/../../..//cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLuaLog(char const*)':
make: Leaving directory `/cygdrive/c/Development/External/cocos2d-2.1rc0-x-2.1.3/projects/Game_C2DX213/proj.android'
C:/Development/External/cocos2d-2.1rc0-x-2.1.3/projects/Game_C2DX213/proj.android/../../..//cocos2dx/platform/android/CCCommon.cpp:54:77: error: format not a string literal and no format arguments [-Werror=format-security]
cc1plus.exe: some warnings being treated as errors

最佳答案

请注意,cocos2d-x-2.1.4 可能与 ndk-r9 不兼容,您尝试使用 r8e 代替吗?

您还可以将其放入您的 Application.mk 中以禁止将这些警告视为错误:APP_CFLAGS += -Wno-error=格式安全

同一问题在本帖中有更多解决方案:

http://www.cocos2d-x.org/boards/6/topics/32437?r=33260#message-33260

reference: http://www.cocos2d-x.org/boards/6/topics/33525?r=33579

关于android - cocos2d-x-2.1.4 : error: format not a string literal and no format arguments [-Werror=format-security],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18393681/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com