Reputation: 5347
I'm using Xcode to develop little C command line tools and I have a header file that looks like this:
#define Bool unsigned char;
#define YES ((Bool) 1);
#define true ((Bool) 1);
#define NO ((Bool) 0);
#define false ((Bool) 0);
In another .c file I'm importing the header file like so
#include "Definitions.h"
Whenever I use Bool
or true
or false
Xcode gives me the following warnings:
Type specifier missing, defaults to 'int'
Declaration does not declare anything
For a function like so:
If I take out the include "Definitions.h"
and just put the defines in the c file all the warnings go away.
What is going on here?
Upvotes: 1
Views: 1335
Reputation: 8215
Remove all the semi-colons from your #define
statements!
Beyond that, there is no need to define these types. They are already there in <stdbool.h>
which gives you bool
, true
, and false
.
Upvotes: 5