Avatar of Shark Boy
Shark Boy
 asked on

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
C++System ProgrammingWeb Languages and Standards

Avatar of undefined
Last Comment
sarabande

8/22/2022 - Mon
SStory

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
Zoppo

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
ASKER CERTIFIED SOLUTION
jkr

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
sarabande

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
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes