C 编译时出现Libev错误
我试图编译一个带有gcc-g-Wall-Wextra-DNDEBUG-pedantic-ansi标志的代码,并使用libev库。我在eclipse中遇到以下错误:C 编译时出现Libev错误,c,syntax-error,static-libraries,libev,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/e
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包。您的
-ansi
标志会导致编译器只接受C89代码,并且只在标准头文件(glibc/gcc)中启用C89功能
libev不是由严格的c89编译器编译而成的,它至少需要一个posix(或者可能是win32)系统,而且可能还使用了一些c99功能。感谢您的回复。我昨天在libev的IRC频道上问它是否符合ansic标准。他们告诉我是的。所以我没有错。感谢您的确认。如果您可以添加此问题的解决方案,那么它实际上会有所帮助。:-)@jparthj问题是
-ansi
标志,解决方法是不使用-ansi或类似标志。好的,我知道了,但在我的情况下,我没有使用-ansi标志,问题存在。@jparthj然后,假设是完全相同的错误,您使用了-std=c99或类似的东西。或者你在一个相当奇怪的平台上,或者你的程序有一些与libev或标准libc头混乱的定义。