我需要帮助!
我在下一个路径中实现了一个 .cpp 程序:home/virginia/android/vlc/src/input/virtual.cpp
/*
* virtual.cpp
*/
#include <stdlib.h>
#include <jni.h>
#include <math.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/types_c.h>
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/photo/photo.hpp>
#include <android/log.h>
extern "C" {
#include "virtual.h"
}
#define LOG_TAG "VLC - Imagen 3D - JNI"
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
using namespace cv;
using namespace std;
extern "C" int camino(void){... }
该程序调用 opencv 函数。
virtual.h (home/virginia/android/vlc/src/input/virtual.h)
/*
* virtual.h
*/
#ifndef __VIRTUAL_H
#define __VIRTUAL_H
int camino(void);
#endif /*__VIRTUAL_H*/
但问题是我需要从decoder.c((home/virginia/android/vlc/src/input/decoder.c)调用“camino”函数:
#include "virtual.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
...
static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
int *pi_played_sum, int *pi_lost_sum ){
...
int res = camino();
msg_Warn( p_dec, "Llamada a virtualJNI devuelve %d", &res );
vout_PutPicture( p_vout, p_picture );
...
}
...
我收到下一个错误:
/home/virginia/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ../vlc/android/src/.libs/libvlccore.a(decoder.o): in function DecoderDecodeVideo:../../src/input/decoder.c:1501: error: undefined reference to 'camino'
collect2: ld returned 1 exit status
make[1]: *** [obj/local/armeabi-v7a/libvlcjni.so] Error 1
make[1]: Leaving directory `/home/virginia/android/vlc-android'
make: *** [vlc-android/obj/local/armeabi-v7a/libvlcjni.so] Error 2
我究竟做错了什么?非常感谢