Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22299

adding include directories causes the compiler to find syntax errors inside stdio.h and other kernel headers

$
0
0

I've been trying to compile a program that simply prints out "hello world" with the cfg80211.h kernel header, as it is a header that I will be using for another project, so I at least want to know that I can include it in a basic program and that it will compile. However, as it is not found within /usr/include, I have to specify include directories for it and its dependencies, but when I include everything that I need, I end up having the compiler give me syntax errors for most of the included header files, including stdio.h.

Here are a couple of the aforementioned errors:

/usr/include/stdio.h:738:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’  738 | extern size_t fread (void *__restrict __ptr, size_t __size,      |               ^~~~~/usr/include/stdio.h:745:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’  745 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,      |               ^~~~~~/usr/include/stdio.h:766:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread_unlocked’  766 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,      |               ^~~~~~~~~~~~~~/usr/include/stdio.h:769:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite_unlocked’  769 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,      |               ^~~~~~~~~~~~~~~

So far I've tried:Reinstalling gcc 13, using gcc 14, using clangSetting environment variables via C_INCLUDE_PATHSetting include paths via the -I argument

I thought the -I argument or the C_INCLUDE PATH (That should simply add more include directories the same way that /usr/include is already included, according to the documentation) would've worked, but it did not, instead it's what started giving me these compilation issues to begin with.


Viewing all articles
Browse latest Browse all 22299

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>