Make can not find <sys/select.h> - c

I'm trying to compile a Contiki OS example on Ubuntu 16.10, but I'm facing the following issue:
$ make
returns
../../platform/slwstk6201a/./contiki-conf.h:40:26: fatal error:
sys/select.h: No such file or directory
#include <sys/select.h>
When I include <stdio.h>, which is in the same folder (but 1 level below sys), the <stdio.h> include does not throw an error. This makes me believe it's an issue with permissions/path variable?
I also tried changing the include to #include </usr/include/sys/select.h>, but that will throw an error, complaining about another include features.h
Any suggestions?

Related

_stdio.h: No such file or directory

`
gcc *.c
In file included from get_next_line.h:16,
from get_next_line.c:13:
/usr/local/Cellar/gcc/12.2.0/lib/gcc/current/gcc/x86_64-apple-darwin20/12/include-fixed/stdio.h:78:10: fatal error: _stdio.h: No such file or directory
78 | #include <_stdio.h>
| ^~~~~~~~~~
compilation terminated.
`
Hello, i got an issue when i try to compile on MAC os (i've just updated it to Ventura), it s like the path to my libraries are not the good one any more, any help on this please ?
I've of course write #include <stdio.h>, the issue was with my GCC installation.
#kotatsuyaki was right, i ve just uninstall and re - install my GCC !
You have an type error (no under score as first character), correct line:
#include <stdio.h>
From _stdio.h file
#ifndef _STDIO_H_
#error error "Never use <secure/_stdio.h> directly; include <stdio.h> instead."
#endif

Linking md5.h library for HTTP Digest sample implementation

I am struggling to compile a simple C program from RFC 2617. The program is digtest.c and it uses digcalc.c, another file from the sample implementation. The latter one depends on two files that my compiler doesn't know about:
#include <global.h>
#include <md5.h>
At first I got this error:
digcalc.c:5:20: fatal error: global.h: No such file or directory
I resolved that by changing <global.h> to <stddef.h>, it seems. But I still get this error:
digcalc.c:7:17: fatal error: md5.h: No such file or directory
Now, md5.h seems to refer to the file found in libbsd. So I installed libbsd-dev and tried to compile the files like this:
gcc digcalc.c digtest.c -o digtest -L/usr/lib/x86_64-linux-gnu -lbsd
where /usr/lib/x86_64-linux-gnu is the location of libbsd.so and libbsd.a files. However, this does not resolve the last compilation error.
Could anyone point out what am I missing here?
Figured it out. Had to change <md5.h> to <bsd/md5.h>, as noted on libbsd page.
So instead of the original headers in digcalc.c:
#include <global.h>
#include <md5.h>
I used:
#include <stddef.h>
#include <bsd/md5.h>
Also had to change function stricmp to strcasecmp, its POSIX equivalent. After that the sample code compiled seamlessly.

Compile c code using gcc without installing mingW/cygwin

I have visual studio installed in my system. So its corresponding compiler and environment variables are set. When i try to compile c file using cl command, it works fine. Now i zipped mingW from another system and extracted it to my system. Say i have it in D:/mingW. Now i have created a batch file for compiling the c file. The contents of the batch file are,
set gccPath=D:/mingW/bin
%gccPath%/gcc.exe -c -std=c99 -o myC.o ../myC.c -I..\.
When i run this batch file, it is producing few errors.
One such error is
stdio.h:209:71: error: macro "snprintf" requires 5 arguments, but only 4 given
The above error might be due to the fact that compiler takes the stdio.h of visual studio instead of mingW's default header file.
Another error is,
error: previous declaration of 'xxxxFun' was here
What should i change in the batch script to compile the c file completely using mingW.
Compilation process is successful when we use Visual Studio, but throws error if we use gcc for the same set of files
EDIT:
I fixed the latter error.
Also the first error doesn't occur when stdio.h is included at first. But if we include stdio.h at the middle of the include section, the error comes.
#include <string.h>
#include <assert.h>
#include <minmax.h>
#include "myFunctions.h"
#include "MyModule.h"
#include <stdio.h>
When we have stdio.h at last as shown, the error is coming. If we move the line #include <stdio.h> to any other lines above #include <MyModule.h> , the specified error is not coming. Any reason behind this strange behavior?
Check whether you are defining snprintf using macros in any of your header files. This error may be caused due to incorrect/unnecessary macro.

TURBO C++: Unable to open include file stdio.h

I am trying to compile a simple C program using TUrbo C++ 3.2. But getting the following error: Unable to open include file 'STDIO.h'
I do have these files in INCLUDE library.
Cant help you if you dont post your code. Check if you use #include <cstdio> (not #include "cstdio" or #include <cstdio.h> or #include "cstdio.h".
#include <cstdio> will always work.

embed ruby code in C

I know there's severals post about this, but i'm stack
here's my C code
#include </usr/include/ruby-1.9.1/ruby/ruby.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
ruby_init();
rb_eval_string("puts 'hello'");
ruby_finalize();
return 0;
}
i've got the following error when compile it in sublime text 2
In file included from /Users/pierrebaille/Code/Ruby/embedRuby/embedRubyFirst.c:1:
/usr/include/ruby-1.9.1/ruby/ruby.h:1481:24: error: ruby/subst.h: No such file or directory
[Finished in 0.1s with exit code 1]
thanks for your help
You should not hard-code the full path of a header file like
#include </usr/include/ruby-1.9.1/ruby/ruby.h>
proper is
#include <ruby.h>
and told your gcc to search the header file via CFLAGS and libariy via LD_FLAGS, simply command without makefile could be:
gcc -o demo.exe -I/path/to/ruby/headers rubydemo.c -L/path/to/ruby/lib -lruby-libary-name
One of you files you're including in turn includes ruby/subst.h, , but it appears that ruby is not in your path, which is why you have this in your code:
#include </usr/include/ruby-1.9.1/ruby/ruby.h>
Instead of hardcoding paths you should simply add "/some_path/" to your compiler path(s) setting, where some_path contains the folder ruby as a child. Now your own include turns into:
#include <ruby/ruby.h>

Resources