ISBN.cpp:8: error: 'ISBN' has not been declared类未声明? (C++)
ISBN.cpp:8: error: ISO C++ forbids declaration of 'ISBN' with no type ISBN.cpp: In function 'int ISBN()':
ISBN.cpp:9: error: 'area' was not declared in this scope
ISBN.cpp:10: error: 'publisher' was not declared in this scope
ISBN.cpp:11: error: 'title' was not declared in this scope ISBN.cpp:12: error: 'checkdigit' was not declared in this scope ISBN.cpp:13: error: 'isbnStr' was not declared in this scope
8号线至14是:
ISBN::ISBN() {
area = NULL;
publisher = NULL;
title = NULL;
checkdigit = NULL;
isbnStr = NULL;
}
他们都在头部声明:
class ISBNPrefix;
class ISBN
{
private:
int area;
int publisher;
int title;
char checkdigit;
char* isbnStr[10];
public:
ISBN();
...
任何想法,这可能是这里的问题?我猜测它简单的东西我错过了。
您可以尝试将格式整理出来吗?很难遵循全部在一行上的代码。缩进所有代码至少4个空格字符,它应该都会更好。 – 2011-03-04 21:54:48
盲目猜测:循环头依赖经常会导致此问题,因为多重保护导致循环头第二次迭代包含失败默默。 – 2011-03-04 21:56:51
你做过##包含在ISBN.cpp中的头文件,对不对? – aschepler 2011-03-04 21:58:24