类未声明?(Class Not Declared?? (C++))
ISBN.cpp:8:错误:'ISBN'尚未被声明
ISBN.cpp:8:错误:ISO C ++禁止在没有类型的情况下声明'ISBN'ISBN.cpp:在函数'int ISBN()'中:
ISBN.cpp:9:错误:'区域'未在此范围内声明
ISBN.cpp:10:错误:'publisher'未在此范围内声明
ISBN.cpp:11:错误:未在此范围内声明'title'ISBN.cpp:12:错误:'checkdigit'未在此范围内声明ISBN.cpp:13:错误:'isbnStr'未在此处声明范围
第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(); ...
任何想法可能是这里的问题? 我猜测它简单的东西我错过了。
ISBN.cpp:8: error: 'ISBN' has not been declared
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
Line 8 through 14 are:
ISBN::ISBN() { area = NULL; publisher = NULL; title = NULL; checkdigit = NULL; isbnStr = NULL; }
They are all declared in the header:
class ISBNPrefix; class ISBN { private: int area; int publisher; int title; char checkdigit; char* isbnStr[10]; public: ISBN(); ...
Any ideas as to what could be the issue here? I'm guessing that its something simple I'm missing.
原文:https://stackoverflow.com/questions/5199716