0xFFAFFF
0xFFAFFF

Reputation: 1

Build C/C++ Executables for android using NDK failed

t_proj.c as follows:

#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("Hello, World!\n");
    return 0;
}

my Android.mk as follows:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE   := t_proj
LOCAL_SRC_FILE := t_proj.c

include $(BUILD_EXECUTABLE)

While compiling with ndk-build, I get the following error:

[armeabi] Executable     : t_proj
/usr/local/Cellar/android-ndk/r10e/platforms/android-3/arch-arm/usr/lib/crtbegin_dynamic.o:crtbrand.c:function _start: error: undefined reference to 'main'
collect2: error: ld returned 1 exit status
make: *** [/Users/[USER]/t_proj/obj/local/armeabi/t_proj] Error 1

Upvotes: 0

Views: 897

Answers (1)

headuck
headuck

Reputation: 2783

Try amending Android.mk:

LOCAL_SRC_FILES := t_proj.c

Upvotes: 1

Related Questions