Cocos2d-x 3.6 running Cocos run with NDK build failed solution

Source: Internet
Author: User

I run Cocos run-p Android compile cheer apk when prompted: jni/. /.. /classes/appdelegate.cpp:67:error:undefined reference to ' Gamemain::c

Reatescene () ', the last error message: NDK build failed!, where Gamemain is the code I wrote myself.

Later, there are two ways to solve the problem:

The first method: in the Android.mk file below the \proj.android\jni, add the CPP file name of all the code you wrote under Local_src_files.

The second method: The disadvantage of the first method is that if the project has a lot of files, manual add is cumbersome, you can refer to the method below, in code to traverse the classes directory

CPP file, it is important to note that all CPP in the Classes folder is useful in the project, and the main code is as follows:

# traversing directories and subdirectories of functions define walk    $ (wildcard $ (1)) $ (foreach E, $ (wildcard $ (1)/*), $ (call Walk, $ (e))) Endef # Traverse Classes Directory Allfi LES = $ (call walk, $ (local_path)/. /.. /classes) File_list: = hellocpp/main.cpp# extracts all. cpp files from all files File_list + = $ (filter%.cpp, $ (allfiles)) Local_src_files: = $ (file_list:$ (Local_path)/%=%)

Reference articles are as follows:

http://tianyiyan.com/cocos2d-x-3-x-%E7%BC%96%E8%AF%91android%E6%96%B9%E6%B3%95/




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Cocos2d-x 3.6 running Cocos run with NDK build failed solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.