用向导生成的Dll中加入自己的类出错!

煜知搬砖者 2003-04-11 08:42:38
但是我按照VC的ATL向导生成了一个Dll
然后我建了一个类
文件名:test.h

class test{
public:
test(){
a = 1;
}
int getIntValue();
void setIntValue(int newInt);
~test(){};
private:
int a;
};
它的实现文件:test.cpp
#include "test.h"
#include "stdafx.h" ----------------------------------------请注意


int test::getIntValue(){
return a ;
}

void test::setIntValue(int newInt){
a = newInt;
}

把这两个文件分别加入相应的文件夹中,但是
在test.cpp中,我把#include "stdafx.h"注释掉后:
VC报错内容为:
fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.

如果不注释掉,VC报错的内容为:
error C2653: 'test' : is not a class or namespace name
error C2065: 'a' : undeclared identifier
error C2653: 'test' : is not a class or namespace name

请大虾们指点分析一下,
...全文
29 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
DavidBone 2003-04-15
  • 打赏
  • 举报
回复
up
NOldkiller 2003-04-11
  • 打赏
  • 举报
回复
同意楼上,因为在VC中会忽略掉#include "stdafx.h"上面一切的文字.
所有报test不是一个类错误也就正常了.
sunyard 2003-04-11
  • 打赏
  • 举报
回复
#include "stdafx.h"
#include "test.h"

不能先#include "test.h"

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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