我的WinMsgBox.cpp能编译可就是运行不能生成DLL文件,到底是为什么呀 ?
WinMsgBox.cpp:
#include "windows.h"
#include "WinMsgBox.h"JNIEXPORT void JNICALL Java_WinMsgBox_showMsgBox
(JNIEnv *env, jobject obj, jstring str){
const char *msg;
msg = env->GetStringUTFChars(str,0);
MessageBox(NULL,msg,"Java invoke",MB_OK);
env->ReleaseStringUTFChars(str,msg);
}
WinMsgBox.java如下:
public class WinMsgBox
{
static{
System.loadLibrary("WinMsgDll");
}
public native void showMsgBox(String str);
}
总是出现错误:
Linking...
Creating library Debug/WinMsgDll.lib and object Debug/WinMsgDll.exp
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/WinMsgDll.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.WinMsgDll.exe - 2 error(s), 0 warning(s)
谁知道帮帮我。
谢谢!
WinMsgBox.cpp:
#include "windows.h"
#include "WinMsgBox.h"JNIEXPORT void JNICALL Java_WinMsgBox_showMsgBox
(JNIEnv *env, jobject obj, jstring str){
const char *msg;
msg = env->GetStringUTFChars(str,0);
MessageBox(NULL,msg,"Java invoke",MB_OK);
env->ReleaseStringUTFChars(str,msg);
}
WinMsgBox.java如下:
public class WinMsgBox
{
static{
System.loadLibrary("WinMsgDll");
}
public native void showMsgBox(String str);
}
总是出现错误:
Linking...
Creating library Debug/WinMsgDll.lib and object Debug/WinMsgDll.exp
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/WinMsgDll.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.WinMsgDll.exe - 2 error(s), 0 warning(s)
谁知道帮帮我。
谢谢!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货