信息隐藏问题

xfxf521 2004-11-21 10:07:37
我用的是cb6.0!
比如说我在文件里定义一个类
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
class a
{
。。。。。。。。
};
#endif

我的主函数写在另外一个文件里!
我要用这个类只要在该文件加
#include"unit1.h"应该就够了吧!
但是怎么系统总提示[Linker Error] Unresolved external 'a::ae()' referenced from D:\PROGRAME\PC13\LIANXI5\MAIN.OBJ这种错误呢?
请指教!
怎么样正确使用的啊?
...全文
78 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xfxf521 2004-11-22
  • 打赏
  • 举报
回复
程序是这样的!
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------

class A
{
public:
int max();
A(int a,int b);
private:
int x,y;
};
#endif
//---------------------------------------------------------------------------


#pragma hdrstop

#include "Unit1.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

A::A(int a,int b)
{
x=a,y=b;
}

int A::A()
{
if(x>y)
return x;
else
return y;
}
/---------------------------------------------------------------------------


#pragma hdrstop

#include "Main1.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)
#include<iostream.h>
#include<conio.h>
#include"Unit1.h"

void main()
{
A B(3,5);
cout<<B.max();
getche();

}
我发现问题所在是因为Unit1的obj文件没生成!这是怎么回事的啊?
greenteanet 2004-11-22
  • 打赏
  • 举报
回复
'a::ae()'这个应该有点问题,仔细看看先...
popxiaozhi 2004-11-21
  • 打赏
  • 举报
回复
看看你在class a中声明的ae函数和定义

64,682

社区成员

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

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