现在我的问题解决了。 如果有人遇到同样的问题,问题出在.so文件中。 以下是用于创建.so文件的.mk文件的脚本。
CC =克++ CFLAG = -g -O0
PRNINC = -I -I ./Include ./PRT.IF -I./app PRNLIBS = -lHWIGotPrinter -lcommon -lpthread -ldl
的astyle =的astyle ASTYLEFLAGS = --style = ANSI -t -p -b -S -K
compiledate = $(壳日期 '+%F%T') DEFS = -D DEFINE_MKDATE =“\ “$(编辑)\”“
INC_PUB = -I./Inclu德-I./PRT.IF -I./SCANNER.IF -I ./Include INCLUDE = $(INC_PUB)
%的.o:%的.cpp $(CC)$(CFLAG)$(DEFS )-fPIC $(含)-C $ < -shared -o $ @
%的.o:%.c的 $(CC)$(CFLAG)$(DEFS)-fPIC $(含)-C $ < -shared -o $ @
.PHONY:所有
所有:PRN
HSCAN CDU UPS
PRNAPPS =仓/ libprntest.so
PRN:$(PRNAPPS)
斌/ libprntest.so:应用程序/ prn_proc.cpp应用程序/ prntest.cpp应用程序/ myCpp.cpp $(CC)$(CFLAG )$(DEFS)$(PRNINC)$(PRNLIBS)$^-o -shared $ @
DIST:所有 的mkdir -p insttest 室射频insttest/* CP -a斌insttest/ CP - f Makefile inst/ tar -czf inst - $(MAJOR)。$(MINOR).tgz insttest/ rm -rf insttest
安装: 安装-m 755 $(PRNAPPS)/ usr/bin
cleanbak: 找到。 -name * .o | xargs rm -f 找到。 -name *〜| xargs rm -f 找到。 -name * .bak | xargs rm -f 找到。 -name * .orig | xargs rm -f 找到。 -name * .cpp | xargs chmod 644 查找。 -name .h | xargs chmod 644 chmod 644 ./etc-lib/gotlib。
clean: 找到。 -name * .o | xargs rm -f 找到。 -name *〜| xargs rm -f 找到。 -name * .bak | xargs rm -f 找到。 -name * .orig | xargs rm -f 找到。 -name * .cpp | xargs chmod 644 查找。 -name是* .h | xargs的文件模式644 RM -f $(PRNAPPS)$(SCANAPPS)$(HSCANAPPS)$(UPSAPPS)$(CDUAPPS)$(HARDWAREAPPS)$(CMOSAPPS)$(TOOLSAPPS)
帮助: 回声“让风格” 回声“让cleanbak” 回声“使清洁” 回声“做” 回声“让DIST” 回声“让安装”
好,。所以应该是短期的共享对象。你的标题说JNA。我认为粘贴一些相关的代码是一个好主意。 – HuStmpHrrr 2014-08-27 13:59:51
那么它是什么调用C或C++?这些是不同的语言。 – 2014-08-27 14:17:31
@ JensGustedt-我正在调用C++函数,并且C++函数正在调用C中库的函数。 – DpkTheJavaCoder 2014-08-28 04:43:04