我正在尝试使用
android ndk(在
Windows上)构建一个项目,我有一些专门针对源文件的问题(
Android.mk中的LOCAL_SRC_FILES)
我正在尝试使用相对路径到父文件夹,如
LOCAL_SRC_FILES:= ../../../src/main.cpp
- Compile++ thumb : GTP <= main.cpp
- The system cannot find the file specified.
- make: *** [obj/local/armeabi/objs/GTP/__/__/__/src/.o] Error 1
所以我尝试使用绝对路径:
- LOCAL_SRC_FILES := D:/Path/To/src/main.cpp
不幸的是,这不起作用,因为:
causes issues on windows
解决方法
根据ndk文档,建议使用相对路径和以下宏(Android.mk使用make文件的语法):
- LOCAL_PATH := $(call my-dir)
- An Android.mk file must begin with the definition of the LOCAL_PATH variable.
- It is used to locate source files in the development tree. In this example,the macro function 'my-dir',provided by the build system,is used to return
- the path of the current directory (i.e. the directory containing the
- Android.mk file itself).
所以你可以用类似的东西替换你的LOCAL_SRC_FILES:
- LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../src/main.cpp