如何在Android的NDK都使用ASIO(独立与Boost)? [英] How to use Asio (standalone from Boost) in Android NDK?
问题描述
短耳(不带升压)被认为是只用头可用的唯一正确的?
Asio (without Boost) is supposed to be usable with just the headers only right?
在默认情况下,ASIO是仅标头库。 ( http://think-async.com )
By default, Asio is a header-only library. (http://think-async.com)
据我所知,国内短耳仍取决于加速。
I understand that internally Asio still depends on Boost.
这是我的设置。
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := gatelib
LOCAL_SRC_FILES := gatelib.cpp
LOCAL_C_INCLUDES += /cygdrive/l/asio-1.5.3/include
LOCAL_C_INCLUDES += /cygdrive/l/boost/boost_1_49_0
include $(BUILD_SHARED_LIBRARY)
Application.mk
APP_STL := stlport_static
APP_CFLAGS += -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB
gatelib.cpp
#include <jni.h>
#include <asio.hpp>
#ifdef __cplusplus
extern "C"
{
#endif
// rest of code ...
#ifdef __cplusplus
}
#endif
生成脚本
@echo on
@set BASHPATH="L:\cygwin\bin\bash"
@set PROJECTDIR="/cygdrive/l/AsioAndroid/AsioDemo"
@set NDKDIR="/cygdrive/l/android-ndk-r8c/ndk-build"
%BASHPATH% --login -c "cd %PROJECTDIR% && %NDKDIR%
@pause:
输出
因此,基本上,我所努力实现的目标是,让短耳工作在Android(通过NDK)。是的,的只是的短耳本身,而不是短耳包括升压。存在的问题是psented在输出$ P $。我不知道所有..
So basically, what I am trying to achieve is, get Asio working on Android (via NDK). Yes, just Asio itself, not the Asio included with Boost. The problems are presented in the output. I have no clue at all..
PS。有没有短耳的标签,所以我想升压短耳标签将不得不做了。
PS. There's no Asio tag, so I guess Boost-Asio tag will have to do for now.
推荐答案
下面就是我所做的。
Application.mk
APP_STL := gnustl_static
APP_CFLAGS += -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB
APP_CPPFLAGS += -fexceptions
的线索和提示都在堆栈溢出。一旦拼凑起来的,它的工作!
The clues and hints were all over Stack Overflow. Once pieced together, it worked!
这篇关于如何在Android的NDK都使用ASIO(独立与Boost)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!