Thread: Basic compiler error

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    13

    Basic compiler error

    Hi, I'm a C++ novice and keep getting this compiler error.

    "In file included from Blah.cpp"

    .. for the following piece of code

    Code:
    #include "Blah.h"
    The code and filenames seem correct. Am I doing something stupidly wrong?
    Thanks
    sammacs

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    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)?
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  3. #3
    Registered User
    Join Date
    Nov 2004
    Posts
    13
    Hi,
    Yer the actual error is this line in "Blah.h"(actually called TextEditorApp.h):
    Code:
    DECLARE_APP(TextEditorApp)
    It says "ISO C++ forbids defining types within return type" and "syntax error before '&' token".
    Please help,
    thanks,
    Sam

  4. #4
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    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.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  5. #5
    Registered User
    Join Date
    Nov 2004
    Posts
    13
    Hi,
    here are the two relevant files. There are also two other files in the project.

    TextEditorApp.h
    Code:
    #ifndef TEXTEDITORAPP_H
    #define TEXTEDITORAPP_H
    
    class TextEditorApp : public wxApp
    {
        public:
        //Initialise the application
        virtual bool OnInit();
    }
    
    DECLARE_APP(TextEditorApp)
    
    #endif //TEXTEDITORAPP_H
    TextEditorApp.cpp
    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;
    }
    Thanks for the help,
    $am

  6. #6
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    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
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  7. #7
    Registered User
    Join Date
    Nov 2004
    Posts
    13
    Yep that was the problem, thanks a lot.
    It really annoys me that I don't spot simple mistakes like that.
    Thanks again,
    Sam

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  2. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  3. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM