动态链接库问题

jxjszh 2010-08-01 04:01:26
以下代码编译时老报错
#ifdef MyDll_EXPORTS
#define DllAPI_declspec(dllexport)
#else
#define DllAPI_declspec(dllimport)
extern "C"
{
DllAPI int _stdcall int Max(int a,int b);
}
#endif
错误如下:
mydll.h(7) : error C2144: syntax error : missing ';' before type 'int'
mydll.h(7) : error C2501: 'DllAPI' : missing storage-class or type specifiers
mydll\mydll.h(7) : fatal error C1004: unexpected end of file found
...全文
46 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuhuaijun 2010-08-01
  • 打赏
  • 举报
回复
mydll.h(7) : error C2144: syntax error : missing ';' before type 'int'
mydll.h(7) : error C2501: 'DllAPI' : missing storage-class or type specifiers

说是不能识别 DllAPI 正如一楼所说, 也可以改为
_declspec(dllexport) _stdcall int Max(int a,int b);
jxjszh 2010-08-01
  • 打赏
  • 举报
回复
DllAPI_declspec(dllexport);能解释一下该句是什么意思吗?
ayw215 2010-08-01
  • 打赏
  • 举报
回复
1
#define DllAPI_declspec(dllexport)
====
#define DllAPI _declspec(dllexport) ==>注意空格

2
DllAPI int _stdcall int Max(int a,int b);
=====
你写了两个int

3,
代码最后一行应该为空白行

64,643

社区成员

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

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