在Netbeans问题中为JNI制作DLL

时间:2010-08-16 17:34:26

标签: java dll netbeans java-native-interface mingw

我正在尝试创建一个DLL以将其与Java JNI一起使用。我正在使用Netbeans C / C ++插件来创建dll。

但是在编译之后我收到以下错误(已经创建了.o对象)

任何想法?我错过了什么吗?

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory `/c/projects/hdijni'
rm -f -r build/Debug
rm -f dist/Debug/MinGW-Windows/libhdijni.dll
make[1]: Leaving directory `/c/projects/hdijni'

CLEAN SUCCESSFUL (total time: 18s)
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/projects/hdijni'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/libhdijni.dll
make[2]: Entering directory `/c/projects/hdijni'
mkdir -p build/Debug/MinGW-Windows/src
rm -f build/Debug/MinGW-Windows/src/ByteJNI.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32   -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include  -MMD -MP -MF build/Debug/MinGW-Windows/src/ByteJNI.o.d -o build/Debug/MinGW-Windows/src/ByteJNI.o src/ByteJNI.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p build/Debug/MinGW-Windows/src
rm -f build/Debug/MinGW-Windows/src/HDIJNI.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32   -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include  -MMD -MP -MF build/Debug/MinGW-Windows/src/HDIJNI.o.d -o build/Debug/MinGW-Windows/src/HDIJNI.o src/HDIJNI.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p build/Debug/MinGW-Windows/src
rm -f build/Debug/MinGW-Windows/src/common.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32   -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include  -MMD -MP -MF build/Debug/MinGW-Windows/src/common.o.d -o build/Debug/MinGW-Windows/src/common.o src/common.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p build/Debug/MinGW-Windows/src
rm -f build/Debug/MinGW-Windows/src/Generic.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32   -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include  -MMD -MP -MF build/Debug/MinGW-Windows/src/Generic.o.d -o build/Debug/MinGW-Windows/src/Generic.o src/Generic.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p build/Debug/MinGW-Windows/src/Windows
rm -f build/Debug/MinGW-Windows/src/Windows/win.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32   -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include  -MMD -MP -MF build/Debug/MinGW-Windows/src/Windows/win.o.d -o build/Debug/MinGW-Windows/src/Windows/win.o src/Windows/win.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p dist/Debug/MinGW-Windows
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32    -shared -o dist/Debug/MinGW-Windows/libhdijni.dll build/Debug/MinGW-Windows/src/ByteJNI.o build/Debug/MinGW-Windows/src/HDIJNI.o build/Debug/MinGW-Windows/src/common.o build/Debug/MinGW-Windows/src/Generic.o build/Debug/MinGW-Windows/src/Windows/win.o  
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `callRuntimePropertiesMethod':
C:/projects/hdijni/src/HDIJNI.c:142: multiple definition of `callRuntimePropertiesMethod'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:288: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `closeJVM':
C:/projects/hdijni/src/HDIJNI.c:192: multiple definition of `closeJVM'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:402: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getFailedCalls':
C:/projects/hdijni/src/HDIJNI.c:251: multiple definition of `getFailedCalls'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:800: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getJNIStatus':
C:/projects/hdijni/src/HDIJNI.c:266: multiple definition of `getJNIStatus'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:900: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getStrategyInfo':
C:/projects/hdijni/src/HDIJNI.c:282: multiple definition of `getStrategyInfo'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1090: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getSuccessfulCalls':
C:/projects/hdijni/src/HDIJNI.c:339: multiple definition of `getSuccessfulCalls'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1154: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getTotalDACalls':
C:/projects/hdijni/src/HDIJNI.c:354: multiple definition of `getTotalDACalls'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1169: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getTotalDACallsFor':
C:/projects/hdijni/src/HDIJNI.c:375: multiple definition of `getTotalDACallsFor'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1190: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `initialiseJVM':
C:/projects/hdijni/src/HDIJNI.c:464: multiple definition of `initialiseJVM'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1229: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `loadStrategy':
C:/projects/hdijni/src/HDIJNI.c:836: multiple definition of `loadStrategy'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1907: first defined heremake[2]: Leaving directory `/c/projects/hdijni'
make[1]: Leaving directory `/c/projects/hdijni'

collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW-Windows/libhdijni.dll] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 1s)

1 个答案:

答案 0 :(得分:1)

抱歉,伙计们,

这是重复方法问题。 ;)

问题已经结束。