Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Issue using c compiler with headers not being recognized

Benjamin_D_1
Beginner
560 Views

I get following error, however, fd_set is defined in /usr/include/sys/select.h

root@benjamin-Lenovo-IdeaPad-Y510P:~/bin/setwidth/src# icc -std=c99 -I /usr/include -I /usr/local/lib/R/include/  -O3 -ipo -xavx -openmp -c setwidth.c 
In file included from setwidth.c(4):
/usr/local/lib/R/include/R_ext/eventloop.h(73): error: identifier "fd_set" is undefined
  extern InputHandler *getSelectedHandler(InputHandler *handlers, fd_set *mask);
                                                                  ^

In file included from setwidth.c(4):
/usr/local/lib/R/include/R_ext/eventloop.h(74): error: identifier "fd_set" is undefined
  extern fd_set *R_checkActivity(int usec, int ignore_stdin);
         ^

In file included from setwidth.c(4):
/usr/local/lib/R/include/R_ext/eventloop.h(75): error: identifier "fd_set" is undefined
  extern fd_set *R_checkActivityEx(int usec, int ignore_stdin, void (*intr)(void));
         ^

In file included from setwidth.c(4):
/usr/local/lib/R/include/R_ext/eventloop.h(76): error: identifier "fd_set" is undefined
  extern void R_runHandlers(InputHandler *handlers, fd_set *mask);
                                                    ^

In file included from setwidth.c(4):
/usr/local/lib/R/include/R_ext/eventloop.h(78): error: identifier "fd_set" is undefined
  extern int R_SelectEx(int  n,  fd_set  *readfds,  fd_set  *writefds,
                                 ^

In file included from setwidth.c(4):
/usr/local/lib/R/include/R_ext/eventloop.h(78): error: identifier "fd_set" is undefined
  extern int R_SelectEx(int  n,  fd_set  *readfds,  fd_set  *writefds,
                                                    ^

In file included from setwidth.c(4):
/usr/local/lib/R/include/R_ext/eventloop.h(79): error: identifier "fd_set" is undefined
                fd_set *exceptfds, struct timeval *timeout,
                ^

In file included from setwidth.c(4):
/usr/local/lib/R/include/R_ext/eventloop.h(79): warning #274: declaration is not visible outside of function
                fd_set *exceptfds, struct timeval *timeout,
                                          ^

setwidth.c(78): warning #167: argument of type "void (*)()" is incompatible with parameter of type "void (*)(void *)"
      R_ToplevelExec(setwidth_Set, NULL);
                     ^

compilation aborted for setwidth.c (code 2)

0 Kudos
2 Replies
Benjamin_D_1
Beginner
560 Views

I would like to note that gcc -I /usr/include/ -I /usr/local/lib/R/include/ -c setwidth.c  works just fine... so this certainly seems like an intel issue

0 Kudos
Judith_W_Intel
Employee
560 Views

 

Hello Benjamin,

Sorry you are having trouble.

I think we need more info here. I tried to reproduce your problem but was unsuccessful, i.e.:

sptxl8-78> cat foo.c

#include <sys/select.h>

extern fd_set* foo();
sptxl8-79> icc -c -std=c99 -I /usr/include -O3 -ipo -xavx -openmp -c foo.c
sptxl8-80>

What would probably help first is to create a preprocessed file for the successful (i.e. gcc) and the unsuccessful (i.e. icc) compilation.

To do that just add -E to the command line, i.e.:

icc -E -std=c99 -I /usr/include .... setwidth.c >iccpreproc.i

gcc -E -std=c99 -I /usr/include .... setwidth.c >gccreproc.i

Then post areply with those two preprocessed files attached to your reply.

We can then compare the two preprocessed files and see what is being included differently.

Intel does distribute a small number of "substitute" headers which contain #include_next directives so perhaps that is causing the problem.

Can you also please tell us what version of icc you are using (do an icc -V).

thanks!

Judy

 

0 Kudos
Reply