AppData \ Local \ Temp \ cc59LXDc.o: test1.cpp: неопределенная ссылка на `constructNewObjectOfClass (JNIEnv_ *, _jthrowable **, char const *, char const *, ...) ' - PullRequest
0 голосов
/ 05 июня 2018

Цель: получить доступ к файлу кластера hadoop (чтение / запись HDFS) через код c ++.Операционная система Windows 7Ниже приведен мой пример кода

#include "hdfs.h"
#include "hdfs.cpp"
int main(int argc, char **argv) {
hdfsFS fs =hdfsConnect( "localhost" , 9000);
return 0
}

ПРИМЕЧАНИЕ. У меня запущен и работает кластер Hadoop с одним узлом.

g++ test1.cpp

Получение трассировки стека ошибок ниже для указанной выше команды:

C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x60): undefined r
eference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, cha
r const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xe1): undefined r
eference to `classNameOfObject(_jobject*, JNIEnv_*)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x242): undefined
reference to `hdfsConnectAsUser'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x296): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2d7): undefined
reference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, ch
ar const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x38b): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x437): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x4cc): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x5e4): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x671): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x6f8): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x77f): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x7e5): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x95e): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xa62): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xb0f): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xba0): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xc45): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xce9): more undef
ined references to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jo
bject*, char const*, char const*, char const*, ...)' follow
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xe53): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xedd): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xf74): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xff2): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x10fd): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x11d8): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1300): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x13cf): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1522): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1587): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1636): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x167f): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1710): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x17ae): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x17f8): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x189f): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x18ed): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x19ab): undefined
 reference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, c
har const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1a8c): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1ad5): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1b93): undefined
 reference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, c
har const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1c74): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1cbd): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1d54): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1dd2): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1eb5): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1f57): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1fc9): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2057): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x212b): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x21ca): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2224): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x22bf): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x231a): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x23b9): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x240d): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x252f): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x257e): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x25d5): undefined
 reference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, c
har const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x267c): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x26e9): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2818): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x28aa): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2948): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2a0d): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2b48): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2e40): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2ebe): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2f1a): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2f56): undefined
 reference to `globalClassReference(char const*, JNIEnv_*)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2ff6): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3045): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3081): undefined
 reference to `globalClassReference(char const*, JNIEnv_*)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3121): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x31b2): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3241): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x32c2): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3347): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x33e7): more unde
fined references to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _j
object*, char const*, char const*, char const*, ...)' follow
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3ade): undefined
 reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3b83): undefined
 reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3ce6): undefined
 reference to `getJNIEnv()'
collect2.exe: error: ld returned 1 exit status

1 Ответ

0 голосов
/ 05 июня 2018

Вы установили библиотеку?

Добавить настройки компоновщика и добавить каталоги поиска компоновщика.

...