Code::Blocks C++ fatal error

Hi, I have a fatal error and I don't know what to do. I'm learning Code::Blocks with the Sroustrup book. Here my code:


//
// This is a GUI support code to the chapters 12-16 of the book
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//

#ifndef SIMPLE_WINDOW_GUARD
#define SIMPLE_WINDOW_GUARD 1

#include "GUI.h"    // for Simple_window only (doesn't really belong in Window.h)
#include "Graph.h"

using namespace Graph_lib;

//------------------------------------------------------------------------------

struct Simple_window : Window {
    Simple_window(Point xy, int w, int h, const string& title );

    bool wait_for_button(); // simple event loop

private:
    Button next_button;     // the "next" button
    bool button_pushed;     // implementation detail

    static void cb_next(Address, Address); // callback for next_button
    void next();            // action to be done when next_button is pressed

};

//------------------------------------------------------------------------------

#endif // SIMPLE_WINDOW_GUARD


//
// This is a GUI support code to the chapters 12-16 of the book
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//

#ifndef SIMPLE_WINDOW_GUARD
#define SIMPLE_WINDOW_GUARD 1

#include "GUI.h"    // for Simple_window only (doesn't really belong in Window.h)
#include "Graph.h"

using namespace Graph_lib;

//------------------------------------------------------------------------------

struct Simple_window : Window {
    Simple_window(Point xy, int w, int h, const string& title );

    bool wait_for_button(); // simple event loop

private:
    Button next_button;     // the "next" button
    bool button_pushed;     // implementation detail

    static void cb_next(Address, Address); // callback for next_button
    void next();            // action to be done when next_button is pressed

};

//------------------------------------------------------------------------------

#endif // SIMPLE_WINDOW_GUARD
3.png
Shark BoyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SStoryCommented:
If you are using Visual C++ then
To locate includable source files, the preprocessor first searches the directories that are specified by the /I compiler option. If the /I option is not present or fails, the preprocessor uses the INCLUDE environment variable to find any include files within angle brackets. The INCLUDE environment variable and /I compiler option can contain multiple paths, separated by semicolons (;). If more than one directory appears as part of the /I option or within the INCLUDE environment variable, the preprocessor searches them in the order in which they appear.

For example, the command

https://msdn.microsoft.com/en-us/library/36k2cdd4.aspx
0
ZoppoCommented:
Hi Shark Boy,

the error message is pretty clear, it tells you a file GUI.h which is included in you code (with #include) couldn't be found by the compiler.

If this is a sample from the mentioned book you should look if there are preceeding instructions, possibly you can find how to get the missing files. If you already have the needed file(s) you'll have to either move them into your project's folder or add a include directory in your project's configuration in order to make it possible the compiler finds the file.

Hope that helps,

ZOPPO
0
jkrCommented:
There's another option:

- locate the directory where "gui.h" and "graph.h" reside
- go to "Control Panel|System and Security|System|Advanced"
- click "Environment Variables" (right above the "OK/Cancel" buttons)
- select "New...", enter "INCLUDE" as the name and the directory path from the 1st point as the calue"

Then, just restart Code::Blocks and everything should be fine.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sarabandeCommented:
This is a GUI support code to the chapters 12-16 of the book

Open in new window

i would assume that gui.h and graph.h were added in an earlier chapter of the tutorial book.

if you just started with the book it makes less sense to start somewhere in the middle but from beginning to avoiding basic issues like the one you reported.

Sara
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.