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.dll");

  if (hDll != NULL)
   { 

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

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

}

//有错误,打印: http://i983.photobucket.com/albums/ae311/keatingWang/c_wrong.png 未声明的标识符 means : Undeclared identifier

最佳答案

考虑宏:

#define HINSTANCE "hDll"

及其用途:

HINSTANCE hDll;   //DLL句柄 

预处理后它看起来像:

"hDll" hDll;

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

关于c - 我的 C 程序有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2627112/

相关文章:

c - 使用c对链表进行选择排序

c - make 时出错 : mingw32-make: *** No rule to make target

c - 查找输入 char* 的大小并将部分复制到输出 char* C

c - 在 C 中使用 API 线程处理文件

c++ - Cortex-A8 强制内存缓存

将返回值与 EBUSY 进行比较

c - 为什么这个简单的程序不能编译?

c - 错误: comparision between pointer and integer

c++ - 如何从Makefile中识别冗余库?有没有什么工具可以分析库的使用情况?

Java从字节数组中提取 double