2011-05-19 85 views
2

當我編譯C文件,上面說的代碼有問題:具有彎曲(在C部分)

pcat.lex:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘hasTab’.

這裏的文件的開頭:

#include "ctype.h" 
#include "stdio.h" 
#include "stdlib.h" 
#include "pcat.tab.h" 
#define YY_USER_ACTION Do_Before_Each_Action(); 
#define STRING_MAX_LENGTH 255 
#define IDENTIFIER_MAX_LENGTH 255 
#define MAX_INT 2147483647 
static int lineno = 1; 
static int colno = 1; 
static bool hasTab; 
void Do_Before_Each_Action(); 

有誰知道是什麼發生?
我正在使用Mac OS X 10.6.7

回答

0

bool不是C.嘗試用int代替。

1

bool不是C99以前的關鍵字。 (實際上,它仍然只是C99中的一個宏。)

1

bool是不是一個識別爲C.

關鍵字您可以嘗試使用g++編譯爲C++,或嘗試定義布爾爲int,與truefalse常數沿。例如:

typedef int bool; 
const bool true = 1; 
const bool false = 0; 

bool a; 

int main() 
{ 
    bool a = true; 
} 

編纂工作正常:

$ gcc test.c 
$ # no errors