开发者

Class Not Declared?? (C++)

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;
cl开发者_开发百科ass 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.


This might seem obvious, but have you double-checked that you actually include the header file in ISBN.cpp? Maybe, you have accidentally used the same preprocessor constant as include guard for two headers, causing the file with the declaration of ISBN to be effectively ignored? The snippets you posted look fine to me…

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜