netbeans jni java 类库,Java-JNI无法在NetBeans上检测到__int64

我正在尝试编译本机库以从Java(与JNI)一起使用它.我遵循了本教程:

https://cnd.netbeans.org/docs/jni/beginning-jni-win.html

错误

当我尝试编译时,出现此错误(请参见第4行):

[...]

In file included from ../../Progra~2/Java/jdk1.8.0_91/include/jni.h:45:0,

from HelloWorldNative.h:3,

from HelloWorldNative.c:6:

../../Progra~2/Java/jdk1.8.0_91/include/win32/jni_md.h:34:9: error: unknown type name '__int64'

typedef __int64 jlong;

^

nbproject/Makefile-Debug.mk:66: recipe for target 'build/Debug/Cygwin-Windows/HelloWorldNative.o' failed

[...]

我可以解决此错误,方法是在#include< jni.h>之前添加typedef long long __int64.但我认为我做错了什么.

编码

这是代码:

头文件:

/* DO NOT EDIT THIS FILE - it is machine generated */

typedef long long __int64; // <============ Why do I need to do this?

#include

/* Header for class helloworld_Main */

#ifndef _Included_helloworld_Main

#define _Included_helloworld_Main

#ifdef __cplusplus

extern "C" {

#endif

/*

* Class: helloworld_Main

* Method: nativePrint

* Signature: ()V

*/

JNIEXPORT void JNICALL Java_helloworld_Main_nativePrint

(JNIEnv *, jobject);

#ifdef __cplusplus

}

#endif

#endif

源文件:

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

#include "HelloWorldNative.h"

JNIEXPORT void JNICALL Java_helloworld_Main_nativePrint

(JNIEnv *env, jobject _this){

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值