Hi, I'm a C++ novice and keep getting this compiler error.
"In file included from Blah.cpp"
.. for the following piece of code
The code and filenames seem correct. Am I doing something stupidly wrong?Code:#include "Blah.h"
Thanks
sammacs
Printable View
Hi, I'm a C++ novice and keep getting this compiler error.
"In file included from Blah.cpp"
.. for the following piece of code
The code and filenames seem correct. Am I doing something stupidly wrong?Code:#include "Blah.h"
Thanks
sammacs
Seems to me its indicating an error in that included file.
Are you sure there is nothing else it says about the error (presumably it'll say what the error is)?
Hi,
Yer the actual error is this line in "Blah.h"(actually called TextEditorApp.h):
It says "ISO C++ forbids defining types within return type" and "syntax error before '&' token".Code:DECLARE_APP(TextEditorApp)
Please help,
thanks,
Sam
We'll need to see more of the file than that one line of code. Is that a function declaration, definition, or call? You might just need a semicolon at the end of the line, but I can't really tell from that piece of code.
Hi,
here are the two relevant files. There are also two other files in the project.
TextEditorApp.h
TextEditorApp.cppCode:#ifndef TEXTEDITORAPP_H
#define TEXTEDITORAPP_H
class TextEditorApp : public wxApp
{
public:
//Initialise the application
virtual bool OnInit();
}
DECLARE_APP(TextEditorApp)
#endif //TEXTEDITORAPP_H
Thanks for the help,Code:#include <wx/wx.h>
#include "TextEditorApp.h"
#include "TextFrame.h"
IMPLEMENT_APP(TextEditorApp)
bool TextEditorApp::OnInit()
{
TextFrame *frame = new TextFrame("Simple Text Editor", 100, 100, 400, 300);
frame->Show(TRUE);
SetTopWindow(frame);
return true;
}
$am
Code:#ifndef TEXTEDITORAPP_H
#define TEXTEDITORAPP_H
class TextEditorApp : public wxApp
{
public:
//Initialise the application
virtual bool OnInit();
}; // <--- Semi-colon here
DECLARE_APP(TextEditorApp)
#endif //TEXTEDITORAPP_H
Yep that was the problem, thanks a lot.
It really annoys me that I don't spot simple mistakes like that.
Thanks again,
Sam