返回信息流test.h
#ifndef TEST_H_INCLUDED
#define TEST_H_INCLUDED
class test
{
public:
test();
~test();
};
#endif
test.cpp
#include "test.h"
test::test()
{
}
test::~test()
{
}
main.cpp
#include <iostream>
#include "test.h"
using namespace std;
int main()
{
test a;
return 0;
}
编译报错:
undefined reference to `test::test()'
undefined reference to `test::~test()'
请教是什么问题啊?
这是一条镜像帖。来源:北邮人论坛 / cpp / #36524同步于 2010/3/11
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖
请教各位大虾
byrmaster
2010/3/11镜像同步6 回复
订阅后,新回复会通过你的通知中心匿名送达。
6 条回复
不熟悉那个东东
你是不是开着main.cpp然后点了编译运行的按钮?
建个工程把文件都加进去吧
【 在 byrmaster 的大作中提到: 】
: 没有啊 我用的CodeBlocks
把#endif挪到#define后边试试
【 在 byrmaster (byrmaster) 的大作中提到: 】
: test.h
: #ifndef TEST_H_INCLUDED
: #define TEST_H_INCLUDED
: ...................