Include Protobuf Library

Hi I would like to add protobufs to my project. So far I am only trying with android and have not been lucky so far.

I have placed my libs : libprotobuf.a , libprotobuf-lite.a, libprotoc.a in “Protobuf” folder right where “Classes” folder can be found.
I have generated one Proto named “Msg.pb.cc” and placed it in Classes folder.
I have placed the Protobuf .h files in the classes folder. i.e. Classes/google/protobuf/…

This is what my Android.mk looks right now.

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE    := libprotoc
LOCAL_SRC_FILES := ../../Protobuf/libprotoc.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := libprotobuf-lite
LOCAL_SRC_FILES := ../../Protobuf/libprotobuf-lite.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := libprotobuf.a
LOCAL_SRC_FILES := ../../Protobuf/libprotobuf.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_CPP_EXTENSION := .cxx .cpp .cc

LOCAL_SRC_FILES += hellocpp/main.cpp \
                   ../../Classes/AppDelegate.cpp \
                   ../../Classes/GameSprite.cpp \
                   ../../Classes/GameLayer.cpp \
                   ../../Classes/Control.cpp \
                   ../../Classes/HelloWorldScene.cpp \
                   ../../Classes/NativeInterface.cpp \
                   ../../Classes/Msg.pb.cc 
                   

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes 

LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static

include $(BUILD_SHARED_LIBRARY)


$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/Box2D)
$(call import-module,external/chipmunk)

I get a lot of errors as soon as it compiles the Msg.pb.cc. Here’s a few:

E:/Android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/Msg.pb.o: in function env10us::Msg::ByteSize() const:jni/../../Classes/google/protobuf/io/coded_stream.h:1091: error: undefined reference to 'google::protobuf::io::CodedOutputStream::VarintSize32Fallback(unsigned int)'
E:/Android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/Msg.pb.o: in function env10us::Msg::ByteSize() const:jni/../../Classes/google/protobuf/io/coded_stream.h:1091: error: undefined reference to 'google::protobuf::io::CodedOutputStream::VarintSize32Fallback(unsigned int)'
E:/Android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/Msg.pb.o: in function env10us::Msg::ByteSize() const:jni/../../Classes/google/protobuf/io/coded_stream.h:1091: error: undefined reference to 'google::protobuf::io::CodedOutputStream::VarintSize32Fallback(unsigned int)'

Somehow, I guess the files are not linked. The code is unable to find the protobuf library.
I don’t know how Android.mk files are written and do not have much experience with cpp as well. This is just the result of some google searches and reading the original Android.mk file.
Any help is appreciated.

cocos2dx-2.2.5
eclipse+ADT.
sdk 5.0.1
ndk r8e

are you using this: https://github.com/google/protobuf/releases

Did you download and use the right version/platform?

I downloaded from the git. 2.6.1
I also downloaded 2.6.0 win32 version too add protobufs to win32 project and they are working fine
But the android is using 2.6.1 ones.

Anyone??

Basically I think I am having difficulty linking these .a (static libraries) files.
The make does not throw an error of not finding the library. But linking might be the problem.