Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3211066
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:41:05+00:00 2026-05-17T14:41:05+00:00

I thought I could use #pragma once to solve my problems but it’s not

  • 0

I thought I could use #pragma once to solve my problems but it’s not working.

Here is my issue.

I have Agui.h which I wanted to be my main header which everything includes:
this is it:

#pragma once

/*
    This header includes all the required headers
    required for Agui

      Author: Josh
*/

//Standard library (STL)

#include <stdlib.h>  
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>

//C runtime
#include <cmath> 
#include <ctime>

//Allegro 5 
#include <allegro5/allegro.h>
#include <allegro5/allegro5.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>

#include "AguiBaseTypes.h"
#include "AguiWidgetBase.h"

AguiBaseTypes.h looks like this:

#pragma once
#include "Agui.h"
#define AguiBitmap ALLEGRO_BITMAP

/*
   This header contains classes for basic types.
   These include:
   Point,
   Size, 
   Rectangle,
   Color
   and their floating equivalents

      Author: Josh
*/


//integer Point class
class AguiPoint {
    int x;
    int y;
public:
    int getX();
    int getY();
    void setX(int x);
    void setY(int y);
    void set(int x, int y);
    AguiPoint(int x, int y);
    AguiPoint();
    std::string toString();
    std::string xToString();
    std::string yToString();

};

//floating version of Agui Point
class AguiPointf {
    float x;
    float y;
public:
    float getX();
    float getY();
    void setX(float x);
    void setY(float y);
    void set(float x, float y);
    AguiPointf(float x, float y);
    AguiPointf(AguiPoint p);
    AguiPointf();
    std::string toString();
    std::string xToString();
    std::string yToString();
};

//Integer rectangle class
class AguiRectangle {
    int x;
    int y;
    int width;
    int height;
public:

    bool isEmpty();
    int getTop();
    int getLeft();
    int getBottom();
    int getRight();
    AguiPoint getTopLeft();
    AguiPoint getBottomRight();
};

class AguiColor {
    unsigned char r;
    unsigned char g;
    unsigned char b;
    unsigned char a;
void verifyColorBounds();
public:
    AguiColor(int r, int g, int b, int a);
    AguiColor(float r, float g, float b, float a);
    AguiColor();
    int getR();
    int getG();
    int getB();
    int getA();
};

and the problematic one, AguiWidgetBase.h

#pragma once
#include "Agui.h"



/*
    This is the base class for all widgets

      Author: Josh
*/
class AguiWidgetBase
{
    //variables
    AguiColor tintColor;
    AguiColor fontColor;
    //private methods
    void zeroMemory();
    virtual void onPaint();
    virtual void onTintColorChanged(AguiColor color);
    void (*onPaintCallback)(AguiRectangle clientRect);
    void (*onTintColorChangedCallback)();


public:
    AguiWidgetBase(void);
    ~AguiWidgetBase(void);
    void paint();
    void setTintColor(AguiColor color);
    AguiColor getBackColor();
};

The compiler is not seeing AguiBaseTypes for AguiWidgetBase. This causes

Warning 13  warning C4183: 'getBackColor': missing return type; assumed to be a member function returning 'int' c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  29
Error   2   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  14
Error   3   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  14
Error   5   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  15
Error   6   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  15
Error   11  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  29
Error   12  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  29
Error   1   error C2146: syntax error : missing ';' before identifier 'tintColor'   c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  14
Error   10  error C2146: syntax error : missing ';' before identifier 'getBackColor'    c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  29
Error   4   error C2146: syntax error : missing ';' before identifier 'fontColor'   c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  15
Error   8   error C2061: syntax error : identifier 'AguiRectangle'  c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  20
Error   7   error C2061: syntax error : identifier 'AguiColor'  c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  19
Error   9   error C2061: syntax error : identifier 'AguiColor'  c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h  28

How could I resolve this? Also is there a way to do it like I want where Agui.h is included everywhere, instead of individual includes which can get confusing over time?

Thanks

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T14:41:06+00:00Added an answer on May 17, 2026 at 2:41 pm

    #pragma once is not guaranteed to be supported on all compilers, use include guards instead. Furthermore, you have cyclic includes: “Agui.h” includes “AguiBaseTypes.h” and vice versa. That’s not the way it’s meant to be.

    A global include file might be okay to reduce boilerplate code in source files, but in header files, you should include exactly the necessary headers, or else you get the problem that you described.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a section of code that I would not like to run if
I use Entity framework for creating model. I have table hierarchy where User is
I would like to solve the following problem using constraints but i actually don't
How can I use XPath to select a node without retrieving all of its
I have a number of algorithms for community detection on graphs that I want
I have a Product table with non-null quantity (decimal) and status (int) columns, and
I am trying to create a script that will self update when it detects
When I start my .net console application from a bat file e.g. start myapp.exe
currently ironing out a way to parse the data of a page: http://www.foundationfinder.ch/ i
Hello i am trying to implement a database-object(connection) pooler for BerkeleyDB... I decided to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.