首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

error C2065: 'hdll' : undeclared identifier,该如何解决

2012-11-03 
error C2065: hdll : undeclared identifier刚刚编写了一个动态链接库的实例,却出现这样的错误,求高手指

error C2065: 'hdll' : undeclared identifier
刚刚编写了一个动态链接库的实例,却出现这样的错误,求高手指教。
#include "stdafx.h"
#include "a.h"
#include "aDlg.h"
__________________________________________________
___________________________________________________
void CADlg::OnButton1() 
{
// TODO: Add your control notification handler code here
  hdll=loadLibrary("text.dll");
if(hdll)
{
typedef void(*PROCTYPE);
  PROCTYPE myprint=(PROCTYPE)GetProcAddress(hdll,"print");//得到函数地址
(*myprint)();
}
FreeLibrary(hdll);//释放库
}
_______________________________________________________________
_________________________
--------------------Configuration: a - Win32 Debug--------------------
Compiling...
aDlg.cpp
C:\Documents and Settings\Administrator\桌面\text\a\aDlg.cpp(177) : error C2065: 'hdll' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\text\a\aDlg.cpp(177) : error C2065: 'loadLibrary' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\text\a\aDlg.cpp(182) : error C2100: illegal indirection
C:\Documents and Settings\Administrator\桌面\text\a\aDlg.cpp(182) : error C2064: term does not evaluate to a function
Error executing cl.exe.

aDlg.obj - 4 error(s), 0 warning(s)



若是添加链接库的头文件#include "text.h"会出现这样的错误,求教哪位大侠能帮忙分析一下,给出正解。
#include "stdafx.h"
#include "a.h"
#include "aDlg.h"
#include "text.h"
———————————————————————————————
______________________________________________
--------------------Configuration: a - Win32 Debug--------------------
Compiling...
aDlg.cpp
C:\Documents and Settings\Administrator\桌面\text\a\aDlg.cpp(7) : fatal error C1083: Cannot open include file: 'text.h': No such file or directory
Error executing cl.exe.

a.exe - 1 error(s), 0 warning(s)


[解决办法]
1、hdll没有定义就直接使用了;
2、loadLibrary前面的l需要大写;
3、需要#include<windows.h>。

热点排行