编译时出现Libev错误

时间:2012-11-15 08:06:47

标签: c syntax-error static-libraries libev

我正在尝试使用gcc -g -Wall -Wextra -DNDEBUG -pedantic -ansi标志编译代码并使用libev库。我在eclipse中遇到以下错误:

Description Resource    Path    Location    Type
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’  Project     line 827, external location: /usr/include/ev.h  C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’  Project     line 820, external location: /usr/include/ev.h  C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’  Project     line 821, external location: /usr/include/ev.h  C/C++ Problem
make: *** [src/Object/MySockets/MySockets.o] Error 1    Project         C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘struct’    Project     line 551, external location: /usr/include/ev.h  C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’   Project     line 559, external location: /usr/include/ev.h  C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘unsigned’  Project     line 825, external location: /usr/include/ev.h  C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘unsigned’  Project     line 826, external location: /usr/include/ev.h  C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’  Project     line 822, external location: /usr/include/ev.h  C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’  Project     line 823, external location: /usr/include/ev.h  C/C++ Problem

我在ubuntu中安装了libev-dev软件包。

1 个答案:

答案 0 :(得分:1)

您的-ansi标志导致编译器仅接受C89代码,并且仅启用标准头文件(glibc / gcc)中的C89功能。

libev不是设计为由严格的c89编译器编译,它至少需要一个posix(或可能是win32)系统 - 并且它可能也使用一些c99特性。