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