什么';我的C程序出了什么问题?

什么';我的C程序出了什么问题?,c,C,cpp文件: #include <iostream> #include <jni.h> #include "Hello.h" #include "windows.h" #include "stdafx.h" typedef void(__stdcall *Print_)(); int main(){ HINSTANCE hDll; //DLL句柄 Print_ print_; //函数指针 hDll = LoadLibrary("Hello.dl

cpp文件:

#include <iostream>
#include <jni.h>
#include "Hello.h"
#include "windows.h"
#include "stdafx.h"

typedef void(__stdcall *Print_)();

int main(){

  HINSTANCE hDll;   //DLL句柄 
  Print_ print_;  //函数指针
  hDll = LoadLibrary("Hello.dll");

  if (hDll != NULL)
   { 

    print_ = (Print_)GetProcAddress(hDll,"Java_Hello_sayHello@8"); 
    if(print_!=NULL)
    {

     print_();
    } 
    FreeLibrary(hDll); 
   }
 return 0;

}
#包括
#包括
#包括“Hello.h”
#包括“windows.h”
#包括“stdafx.h”
typedef void(u stdcall*Print_uu)();
int main(){
HINSTANCE hDll;//DLL句柄 
打印uu打印uu//函数指针
hDll=LoadLibrary(“Hello.dll”);
如果(hDll!=NULL)
{ 
打印=(打印)GetProcAddress(hDll,“Java\u你好_sayHello@8"); 
如果(打印?=NULL)
{
列印();
} 
免费图书馆(hDll);
}
返回0;
}
//有点问题,它会打印: 未声明的标识符 表示:未声明的标识符考虑宏:

#define HINSTANCE "hDll"
及其用途:

HINSTANCE hDll;   //DLL句柄 
预处理后,它看起来像:

"hDll" hDll;
这显然是一个错误,因为它使
hDll
未声明为
“hDll”
不是有效的类型。

请考虑以下宏:

#define HINSTANCE "hDll"
及其用途:

HINSTANCE hDll;   //DLL句柄 
预处理后,它看起来像:

"hDll" hDll;
这显然是一个错误,因为它使
hDll
未声明为
“hDll”
不是有效类型。

删除

#define HINSTANCE "hDLL"
要删除C4627警告,请向上移动
#include“stdafx.h”
到顶部(作为第一个#include),如的所示。这可能会解决
LoadLibrary
GetProcAddress
FreeLibrary
的错误:

#include "stdafx.h" // moved up
#include <iostream>
#include <jni.h>
#include "Hello.h"
#include "windows.h"
#包括“stdafx.h”//上移
#包括
#包括
#包括“Hello.h”
#包括“windows.h”
删除

#define HINSTANCE "hDLL"
要删除C4627警告,请向上移动
#include“stdafx.h”
到顶部(作为第一个#include),如的所示。这可能会解决
LoadLibrary
GetProcAddress
FreeLibrary
的错误:

#include "stdafx.h" // moved up
#include <iostream>
#include <jni.h>
#include "Hello.h"
#include "windows.h"
#包括“stdafx.h”//上移
#包括
#包括
#包括“Hello.h”
#包括“windows.h”

这可能是预编译的标题问题吗?在一些项目设置中,VC++会跳过
#include“stdafx.h”
之前的内容,我认为这可能是您收到C4627警告的原因。您是否尝试过将
#include“stdafx.h”
移动到其他
#include
s之前?

这可能是预编译的标题问题吗?在一些项目设置中,VC++会跳过
#include“stdafx.h”
之前的内容,我认为这可能是您收到C4627警告的原因。您是否尝试过将
#include“stdafx.h”
移动到其他
#include
s之前?

您更有可能通过错误号(C,然后是一组数字)然后是实际消息来获得帮助,如果不是英文的,请特别注意。如果您更改了代码,请更新图像。如果您坚持在源代码中使用ASCII的32-127子集,请帮我们和您自己一个忙(阅读:坚持使用英文)。这是语言程序员交流的,就像你和我喜欢的语言一样,这是C还是C++?您包括但已将此标记为C@wilhelmtell“坚持源代码中ASCII的32-127子集”-->希望您不介意源代码中的代码10。您更可能通过错误号(C,然后是一组数字)然后实际消息来获得帮助,如果不是英文的,请特别注意。如果您更改了代码,请更新图像。如果您坚持在源代码中使用ASCII的32-127子集,请帮我们和您自己一个忙(阅读:坚持使用英文)。这是语言程序员交流的,就像你和我喜欢的语言一样,这是C还是C++?您包括但已将此标记为C@wilhelmtell“坚持源代码中ASCII的32-127子集”-->希望您不介意源代码中的代码10。删除#定义HINSTANCE“hDll”仍有错误删除#定义HINSTANCE“hDll”仍有错误