2013. 8. 28. 18:42

[Cocos2d-x] build_native.sh 오류 해결하기.

cocos2d-x 프로젝트를 visual studio로 작업하고 apk 생성을 위해 작업을 진행하던중 다음과 같은 오류가 발생합니다.


version : visual studio 2012, ndk r9


Compile++ thumb  : cocos2dx_static <= CCCommon.cpp
In function 'void cocos2d::CCLog(char const*, ...)':
CCCommon.cpp:44:72: error: format not a string literal and no format arguments [-Werror=format-security]
CCCommon.cpp: In function 'void cocos2d::CCLuaLog(char const*)':
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


jni 폴더의 Application.mk 파일에 다음 라인을 마지막에 삽입하면 오류 없이 컴파일이 진행됩니다.

( 혹은 APP_CPPFLAGS의 마지막에 -Wno-error=format-security 를 추가해줘도 됩니다. )


APP_CFLAGS += -Wno-error=format-security



근데 이게 매번 프로젝트 생성해줄때마 해주는게 번거롭다는 생각이 들었습니다...

쭉 살펴보니, cpp 프로젝트의 경우 sample/HelloCpp/proj.android 에서 template을 끌어오는걸 확인했네요.

( 왜 template 폴더가 아닌거야 응? -_- )


cocos2d-x root 디렉토리의 sample/HelloCpp/proj.android/jni/Application.mk 파일 맨 아래에도 위 라인을 삽입해주면 앞으로 생성되는 프로젝트는 다 달려서 나옵니다.