Linker Command Failed with exit code 1

Hi,
I have followed all the steps properly mentioned for making an android build but when i try to run i get this error
http://pastebin.com/NHHgGuUD (Paste Bin for better understanding)

1)I have latest android adt tools
2)Working on windows machine
3)Android Ndk is r9d…earlier i was using 10c but got to know that it was not compatible with cocos2dx yet
4)Using visual studio to make win.32 project.Windows project is working fine
5)Followed steps from documentation on how to make android build
6)Using cocos2dx3.3rc0

But still struggling with this issue for the past 1 week.

I am a newbie to cocos2dx.Please Help me out
Thanks


This is not something related to cocos2d-x.

You need to provide more information. Is Catchme implemented in a lib? If so, did you link it?

Are the source files for CatchMe added to your .mk file?

Catch Me is the project name that i am following through tutorials.
And i have added CatchMe.cpp and CatchMe.h files in classes folder

You also have to add the .cpp file to LOCAL_SRC_FILES in your Android.mk file.


1 Like

Thanks iQD…It Works now…You Made my day!!!
Just wanted to clarify do we need to add every cpp file in the android.mk file manually or is there an automated way.

No, it can be automated in different ways. It supports wildcards. You have to read the NDK docs, if you want to get everything out from the build system.
Some scripts/IDEs, which can automate it, do it for you.

There are a lot of tutorials and infos out there, just search for “wildcard Android.mk”.

A nice post about wrong and correct attempts is here: http://timecubepuzzle.blogspot.co.at/2012/05/how-to-use-makefile-wildcardsglobbing.html

1 Like

Thanks iQD for the help

Hi,

I know this is old post but I am kind of having the same issue. The only difference is I am trying to link to my .a file and I am getting the undefined reference error. Can you please take a look at the .mk file if there is something wrong I am doing.

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := android
LOCAL_SRC_FILES := ../../Source/sdk/lib/libandroid.a \
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos/audio/include)

LOCAL_MODULE := MyGame_shared

LOCAL_MODULE_FILENAME := libMyGame

LOCAL_SRC_FILES := hellocpp/main.cpp \
                   ../../Classes/AppDelegate.cpp \
                   ../../Classes/HelloWorldScene.cpp \
		   ../../Source/frkcocos/Our.cpp \
		   ../../Source/frkcocos/Our1.cpp \
		   ../../Source/frkcocos/Our2.cpp \
		   ../../Source/frkcocos/Our3.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
		    $(LOCAL_PATH)/../../Source/frkcocos \
		    $(LOCAL_PATH)/../../Source/sdk/include \
		    $(LOCAL_PATH)/../../Source/sdk/lib
					
# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END

LOCAL_STATIC_LIBRARIES := cocos2dx_static \
			  libandroid.a

# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END

include $(BUILD_SHARED_LIBRARY)

$(call import-module,.)

# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END
```

the functions that are in .a file gets the undefined reference errors.

Thanks,
Abe

Change it to:

LOCAL_STATIC_LIBRARIES := cocos2dx_static \
                          android