运行makefile——add-stdcall-alias时的JNI问题

Issue with JNI when run makefile --add-stdcall-alias

本文关键字:JNI 问题 时的 add-stdcall-alias makefile 运行      更新时间:2023-10-16

当我用目标all运行makefile时,我遇到了JNI问题

这是我的问题:

**** Build of configuration Default for project TestTapeJNI ****
make all 
javah -classpath ../bin TestTape
gcc -I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include"I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include/linux" -c TestTape.c -o TestTape.o
gcc -Wl,--add-stdcall-alias -shared -o Tape.dll TestTape.o 
/usr/bin/ld: unrecognized option '--add-stdcall-alias' 
/usr/bin/ld: use the --help option for usage information collect2: ld returned 1 exit status
make: *** [Tape.dll] Error 1

你知道是什么问题吗?

编辑

如果我试图从makefile中取消它,则会触发此问题

make all 
javah -classpath ../bin TestTape
gcc -Wl, -shared -o Tape.dll TestTape.o
/usr/bin/ld: cannot find : No such file or directory
collect2: ld returned 1 exit status
make: *** [Tape.dll] Error 1

MAKEFILE

# Define a variable for classpath
CLASS_PATH = ../bin
# Define a virtual path for .class in the bin directory
vpath %.class $(CLASS_PATH)
all : Tape.dll
# $@ matches the target, $< matches the first dependancy
Tape.dll : TestTape.o
    gcc -Wl, -shared -o $@ $<
# $@ matches the target, $< matches the first dependancy
TestTape.o : TestTape.c TestTape.h
    gcc -I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include"  -I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include/linux" -c $< -o $@
# $* matches the target filename without the extension
TestTape.h : TestTape.class
    javah -classpath $(CLASS_PATH) $*
clean :
    rm TestTape.h TestTape.o Tape.dll

按此链接http://www.delorie.com/gnu/docs/binutils/ld_4.html

所以一个有效的解决方案是删除它(. std. alisa.),你的gcc命令现在变成:
gcc -Wl -shared -o Tape.dll TestTape.o