Results 1 to 6 of 6
Hi,
I am writing simple program, which includes .h file which having structure defined as like this:
-----------------------------------
/* main.h */
#ifndef _MAIN_H_
#define _MAIN_H_ 1
void Rules();
typedef struct ...
- 03-28-2008 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 50
gcc -c main.c In file included from main.c:1: Getting Error: expected specifier
Hi,
I am writing simple program, which includes .h file which having structure defined as like this:
-----------------------------------
/* main.h */
#ifndef _MAIN_H_
#define _MAIN_H_ 1
void Rules();
typedef struct _CRules{
int var1;
char *var2;
bool var3
} CRules;
#endif
------------------------------------
while compling my main.c i'm getting this error
$gcc -c main.c
In file included from main.c:1:
main.h:11: error: expected specifier-qualifier-list before ‘bool’
why this ??
Thanks,
- 03-28-2008 #2
Two problems.
- It would be best to put a semicolon (";") at the end of the var3 line.
- Have you actually defined the bool type anywhere?
Hope this helps.--
Bill
Old age and treachery will overcome youth and skill.
- 03-28-2008 #3Just Joined!
- Join Date
- Feb 2008
- Posts
- 50
Thanks Bill,
(1) I putted ";" at end of var3. But the same problem.
(2) In code, I havn't defined anywhere bool
my problem is, when i remove bool it compiles successfully, only bool is not working..
- 03-28-2008 #4
One solution is to use int instead of bool.
--
Bill
Old age and treachery will overcome youth and skill.
- 03-28-2008 #5Just Joined!
- Join Date
- Dec 2007
- Location
- Algeria
- Posts
- 26
the type bool doesn't exist in C, you have to define it first or use unsigned instead.
- 07-20-2011 #6Just Joined!
- Join Date
- Jul 2011
- Posts
- 1
Include the file stdbool.h file to your program. Thats it. In some version of GCC bool is defined in this file.


