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

  • SEARCH
  • Home
  • 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 8267073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:23:18+00:00 2026-06-08T05:23:18+00:00

I have a double type bool so have added to a header: typedef double

  • 0

I have a double type bool so have added to a header:

typedef double bool;
extern bool true;
extern bool false;

with:

bool true = 1.0;
bool false = 0.0;

in the corresponding C file.

However I now have the errors multiple definition of true, and the same for false, pointing to the first line of the first function in the C file. the error that says ‘previous declaration was here’ points to the same line… it doesnt make any difference which function is placed first in the file it always points to it.

My header files, though included via a common header file, do have include guards so I hopefully shouldn’t have multiple declaration of true and false there.

I have changed the typedef to tBool with vars tTrue and tFalse, which solves the problem, but I don’t get why it occurred in the first place? As there are still some bool types using true and false in the code it seems like the compiler may have a definition for true and false as ints already… though I didn’t think C did this

Im using dev-c++ 4.9.9.2 IDE that uses mingw, though Im not sure which version mingw.

Anyone know why this happened?

  • 1 1 Answer
  • 0 Views
  • 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-06-08T05:23:20+00:00Added an answer on June 8, 2026 at 5:23 am

    It sounds to me like your parameter is not really a Boolean value at all. You have a floating point parameter with special cases for the discrete numbers 0.0 and 1.0. Create two double constants instead of a type.

    C99 added definitions for the type _Bool, a macro bool, a macro true, and a macro false. Try inserting the following in your header:

    #if __bool_true_false_are_defined
    # error "stdbool.h has been included"
    #endif
    #ifdef bool
    # error "bool is already DEFINED"
    #endif
    #ifdef true
    # error "true is already DEFINED"
    #endif
    #ifdef false
    # error "false is already DEFINED"
    #endif
    

    If any of these fire, then you are including stdbool.h somewhere. You should be able to #undef the three macros and then set up your types safely. Of course, this will probably break if someone else expects bool to be a small integer value and has more style problems that you can shake a stick at.

    ISO/IEC 9899:1999 does make a concession to the fact that many groups have already defined their own Boolean types before it was added to the Standard. This is the rationale for defining bool, true, and false as macros instead of new keywords. However, the following warning is explicitly included:

    7.26.7 Boolean types and values <stdbool.h>

    The ability to undefine and then perhaps redefine the macros bool, true, and false is an obsolescent feature.

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

Sidebar

Related Questions

I have a program with an associated file type. However, when I double-click a
i have a dynamically made prototype: typedef double ICEDouble; -(BOOL) getPosition:(SyDRpcInterfacePositionType)type longitude:(ICEDouble *)longitude latitude:(ICEDouble
I have a typedef boost::variant<int, float, double, long, bool, std::string, boost::posix_time::ptime> variant which I
I have an array of type Double() (1 x n ) that I am
Why does .Net not have the System.Float type like System.String , System.Double etc.?
Let's assume, that we have an enumered type: enum DataType { INT, DOUBLE };
Right now I have double numba = 5212.6312 String.Format({0:C}, Convert.ToInt32(numba) ) This will give
struct Message { char type; double idNum; char *Time; char *asset; bool BS; float
I have a boost variant of looking like this: typedef boost::variant<int, float, double, long,
I have the following variant from the boost lib: typedef boost::variant<int, float, double, long,

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.