Cocos porting to Android some problems-sqlite3 database porting problems

Source: Internet
Author: User

Preferred we discuss the SQLite3 database porting problem. In the 14th chapter we introduced the use of the SQLite3 database on the Win32 platform, we introduced two ways to configure the environment: one is to use the SQLite3 library configuration provided by Cocos2d-x, and the other is to download the source code copy from the SQLite website. The first method is more cumbersome to configure, and the key is that the SQLite3 library provided by Cocos2d-x is just Win32 no other platform, and the directory structure is as follows.
< Games Engineering Catalogue >\cocos2d\external\sqlite3
│android.mk

├─include
│sqlite3.h
│sqlite3ext.h

└─libraries
└─win32
Sqlite3.dll
Sqlite3.lib
Therefore, we can only use the second method, download the source code compression package from the SQLite official website, copy the Sqlite3.h and sqlite3.c files to the classes directory of the project, and then open the < game Project Catalog >\proj.android\jni\ ANDROID.MK file, modify the Local_src_files content as follows:
Local_src_files: = hellocpp/main.cpp \
.. /.. /classes/appdelegate.cpp \
.. /.. /classes/helloworldscene.cpp \
.. /.. /classes/sqlite3.c
Where sqlite3.c is the one we just appended, after saving the android.mk file, use the Cocos tool to cross-compile, in the process of compiling if we can see the content (cocos2dcpp_shared <= SQLITE3.C), stating that the Sqlite3 compiler passed.


Successfully compiled Sqlite3

If it compiles successfully, it means that SQLite3 's porting is successful, and we can write access data code.

We use third-party libraries either as header files and source program files, or as header files and library files (Dynamic Connection library. So or static connection library. a). SQLite3 's transplant we used header and source program files.


For more information, please pay attention to the first Cocos2d-x 3.2 Edition book "Cocos2d-x: C + + volume"

Book Exchange Discussion website: http://www.cocoagame.net
For more exciting video courses, please follow Cocos class: Http://v.51work6.com

Welcome to join Cocos2d-x Technical discussion group: 257760386

Welcome to Luxgen iOS Classroom public Platform


Cocos porting to Android some problems-sqlite3 database porting problems

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.