Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have multiple options here assuming that you have a first.cpp file that you implemented the Test class correctly. Without being able to see your Android.mk, I will go through all options:</p> <p>Build First.cpp as a static or shared library and add this library to your module which compiles Second.cpp. Your Android.mk should look like:</p> <pre><code>LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := firstlib LOCAL_C_INCLUDES := path/to/first.h LOCAL_SRC_FILES := first.cpp include $(BUILD_STATIC_LIBRARY) </code></pre> <p>If you would like First to be a shared library instead of a static library, change include $(BUILD_STATIC_LIBRARY) line to:</p> <pre><code>include $(BUILD_SHARED_LIBRARY) </code></pre> <p>Now, your second lib is compiled as follows:</p> <pre><code>include $(CLEAR_VARS) LOCAL_MODULE := second LOCAL_C_INCLUDES := path/to/first.h LOCAL_C_INCLUDES += path/to/second.h LOCAL_SRC_FILES := second.cpp LOCAL_STATIC_LIBRARIES := firstlib include $(BUILD_SHARED_LIBRARY) </code></pre> <p>If firstlib is built as shared library, you can link it by chaning LOCAL_STATIC_LIBRARIES += firstlib line to the following:</p> <pre><code>LOCAL_SHARED_LIBRARIES += firstlib </code></pre> <p>As a second solution, you can build first.cpp as a part of the second lib and this way you don't have to worry about linking against the first library. This is more like a design choice and how you would like to shape up your libraries:</p> <pre><code>include $(CLEAR_VARS LOCAL_MODULE := libtwolib-second include $(CLEAR_VARS) LOCAL_MODULE := libtwolib-second LOCAL_C_INCLUDES := path/to/first.h LOCAL_C_INCLUDES += path/to/second.h LOCAL_SRC_FILES := first.cpp LOCAL_SRC_FILES += second.cpp include $(BUILD_SHARED_LIBRARY) </code></pre> <p>Finally, you can find a sample of the first approach in your NDK directory, under samples/twolibs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload