获取错误:ISO C ++禁止声明没有类型 [英] Getting error: ISO C++ forbids declaration of with no type
本文介绍了获取错误:ISO C ++禁止声明没有类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误:
ISO C ++禁止没有类型的ttTreeInsert的声明
ISO C++ forbids declaration of ttTreeInsert with no type
ISO C ++禁止没有类型的ttTreeDelete的声明
ISO C++ forbids declaration of ttTreeDelete with no type
ISO C ++禁止没有类型的ttTreePrint的声明
ISO C++ forbids declaration of ttTreePrint with no type
原型为int ttTree :: ttTreePrint()不匹配任何在类ttTree
prototype for int ttTree::ttTreePrint() does not match any in class ttTree
候选人是:void ttTree :: ttTreePrint()
candidate is: void ttTree::ttTreePrint()
这是我的头文件:
#ifndef ttTree_h
#define ttTree_h
class ttTree
{
public:
ttTree(void);
int ttTreeInsert(int value);
int ttTreeDelete(int value);
void ttTreePrint(void);
};
#endif
这是我的.cpp文件:
Here is my .cpp file:
#include "ttTree.h"
ttTree::ttTree(void)
{
}
ttTree::ttTreeInsert(int value)
{
}
ttTree::ttTreeDelete(int value)
{
}
ttTree::ttTreePrint(void)
{
}
任何人都能指出导致这些错误的原因是什么?谢谢!
Can anyone point out what is causing these errors? Thank you!
推荐答案
您在成员函数定义中忘记了返回类型:
You forgot the return types in your member function definitions:
int ttTree::ttTreeInsert(int value) { ... }
^^^
等等。
这篇关于获取错误:ISO C ++禁止声明没有类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文