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

煜知搬砖者 煜知搬砖者 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
但是我按照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

请大虾们指点分析一下,
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
煜知搬砖者
ATL 3,248 成员 48,530 内容