您的位置:首页 > 移动开发 > Android开发

protobuf&android

2015-02-05 21:02 330 查看
google&android

1、google编译时没有config.h

直接拷贝根目录下config.h放到google/protobuf下

2、backward_warning.h: No such file or directory错误

Change:

#include "backward_warning.h"

To:

#include "../backward/backward_warning.h"

3、Android.mk指定以下项:

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static protobuf_static

$(call import-module,google/protobuf)

LOCAL_C_INCLUDES += $(LOCAL_PATH)/../

jni/hellocpp/main.cpp下注释以下语句:

//#include "HelloWorldScene.h"

附一:

google/protobuf/Android.mk

#build google protobuf

LOCAL_PATH := $(call my-dir)

ifeq (,$(strip $(wildcard $(LOCAL_PATH)/obj/local/armeabi/libprotobuf_static.a)))

PROTOBUF_REBUILD := true

endif

libprotobuf_path := $(call my-dir)

libprotobuf_src_files :=
\

descriptor.cc \

descriptor.pb.cc \

descriptor_database.cc \

dynamic_message.cc \

extension_set.cc \

extension_set_heavy.cc \

generated_message_reflection.cc \

generated_message_util.cc \

io/coded_stream.cc \

io/gzip_stream.cc \

io/printer.cc \

io/tokenizer.cc \

io/zero_copy_stream.cc \

io/zero_copy_stream_impl.cc \

io/zero_copy_stream_impl_lite.cc \

message.cc \

message_lite.cc \

reflection_ops.cc \

repeated_field.cc \

service.cc \

stubs/common.cc \

stubs/once.cc \

stubs/structurally_valid.cc \

stubs/strutil.cc \

stubs/substitute.cc \

text_format.cc \

unknown_field_set.cc \

wire_format.cc \

wire_format_lite.cc 

libprotobuf_static_libs := libstdc++

libprotobuf_cflags := 

libprotobuf_cppflags := -fuse-cxa-atexit

libprotobuf_c_includes :=$(libprotobuf_path)/../.. $(libprotobuf_path)/../../../Android $(libprotobuf_path)/.. $(libprotobuf_path)/protobuf

# Note: For now, this implementation depends on the system libstdc++

#       We may want to avoid that in the future, i.e. in order to

#       properly support exceptions and RTTI.

libstlport_static_libs := libstdc++

ifneq ($(PROTOBUF_REBUILD),true)

include $(CLEAR_VARS)

LOCAL_MODULE := protobuf_static

LOCAL_SRC_FILES := obj/local/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).a

LOCAL_STATIC_LIBRARIES := $(libprotobuf_static_libs)

LOCAL_EXPORT_C_INCLUDES := $(libprotobuf_c_includes)

include $(PREBUILT_STATIC_LIBRARY)

else

include $(CLEAR_VARS)

LOCAL_MODULE := protobuf_static

LOCAL_CPP_EXTENSION := .cc

LOCAL_SRC_FILES := $(libprotobuf_src_files)

LOCAL_CFLAGS := $(libprotobuf_cflags)

LOCAL_CPPFLAGS := $(libprotobuf_cppflags)

LOCAL_C_INCLUDES := $(libprotobuf_c_includes)

LOCAL_STATIC_LIBRARIES := $(libprotobuf_static_libs)

LOCAL_EXPORT_C_INCLUDES := $(libprotobuf_c_includes)

include $(BUILD_STATIC_LIBRARY)

endif
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  protobuf android