Question

I'm trying to compile a code with gcc -g -Wall -Wextra -DNDEBUG -pedantic -ansi flags and to use libev library. I am getting the following errors in 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

I've installed the libev-dev package in ubuntu.

Was it helpful?

Solution

Your -ansi flag causes the compiler to only accept C89 code, and will only enable C89 features in the standard header files (of glibc/gcc).

libev isn't designed to be compiled by a strict c89 compiler, it needs at least a posix (or possibly win32) system - and likely it uses a few c99 features as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top