error C2065: 'hdll' : undeclared identifier

泡芙女孩儿 2012-10-22 11:19:37
刚刚编写了一个动态链接库的实例,却出现这样的错误,求高手指教。
#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)
...全文
152 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
图灵狗 2012-10-22
  • 打赏
  • 举报
回复
1、hdll没有定义就直接使用了;
2、loadLibrary前面的l需要大写;
3、需要#include<windows.h>。

65,187

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧