Cocos2dx + libevent library, cocos2dxlibevent Library

Source: Internet
Author: User

Cocos2dx + libevent library, cocos2dxlibevent Library

Path: $ path = cocos2dx/platform/third_party

1. win32

Put the generated libevent_core.lib and libevent_extras.lib in $ path/win32/libraries.

Put the header file event2 and the event-config.h in $ path/win32/libevent.

Set include path and add lib in

 

2. ios

Generate the library file (libevent_core.a, libevent_extra.a, libevent_pthreads.a) for the IOS platform and put it in $ path/ios/libraries. Note: it is the library file for IOS, not for linux.

Put the header file in $ path/ios/libevent

Add head search path and the three library files in xcode.

The library file is also generated using the libevent OnionBrowser.

 

3. android

Android is so difficult that it takes a long time to complete it.

Problem list

1). logcat output debugging: Add LOCAL_CFLAGS: =-DCOCOS2D_DEBUG = 1 to proj. android/jni/andoird. mk.

2) during the ndk build process, the system prompts that htons could not be found. After checking for a long time, we found that the custom endian. h and system file were renamed.

3). After the buffer is added, bufferevent_socket_connect returns-1, and the connection fails.

The reason is that you do not have the network permission. Add the permission application in proj. android/AndroidManifest. xml

<Uses-permission android: name = "android. permission. INTERNET"> </uses-permission>

4) after the ndk build is complete, the connection fails. Some library functions cannot be found because the libevent is being built. a comments a section. The link character "\" is used to comment out all the following sections,

The libevent. Package is incomplete.

 

Add Library: on the internet, git finds a libevent for andoird, build it with ndk, and put it in $ path/android/libevent. The. mk file is written in the same way as libcurl.

Link: https://github.com/ventureresearch/libevent/tree/master

Then add LOCAL_STATIC_LIBRARIES + = cocos_event_static in proj. android/jni/andoird. mk;

$ (Call import-module, cocos2dx/platform/third_party/android/prebuilt/libevent)

Related Article

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.