简体   繁体   中英

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

尝试修改Android.mk

LOCAL_SRC_FILES := t_proj.c

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM