Linux gcc stdio h

Linux. Ошибка при компиляции stdio.h no such file or directory

Ради всего доброго, скажите, что нужно сделать?! Этот Линукс меня скоро убьет. Я разбираюсь с чем-то одним — тут же возникает что-то другое. Ох, какое счастье, что люди додумались до IDE, а не используют терминалы.
Очевидно, что нет библиотеки. И через поиск ее нет. Как установить? Если что, компилирую через «gcc «name».c»
Пробовал через Synaptic переустановить gcc — увы

1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include #include int main()  char buffer[100] = "It_was_readed.."; int len; int fhandle; char fname[] = "res.txt"; fhandle = open(fname,O_WRONLY

Ошибка при компиляции No such file or directory
Компилятор MinGW. Выдает No such file or directory #include <uv.h> Указываю так.

./stdio-common/printf_fphex.c: No such file or directory
Здравствуйте. По необходимости совсем недавно начал учить С под Линукс. Пишу две программы.

Лучший ответ

Сообщение было отмечено Shadevskiy как решение

Решение

sudo apt install libc6-dev
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
$> apt show libc6-dev Package: libc6-dev Version: 2.24-10 Priority: optional Section: libdevel Source: glibc Maintainer: GNU Libc Maintainers debian-glibc@lists.debian.org> Installed-Size: 16,0 MB Provides: libc-dev Depends: libc6 (= 2.24-10), libc-dev-bin (= 2.24-10), linux-libc-dev (>= 4.9.18-1) Suggests: glibc-doc, manpages-dev Conflicts: libc0.1-dev, libc0.3-dev, libc6.1-dev Breaks: binutils ( <2.26), binutils-gold ( <2.20.1-11), cmake ( <2.8.4+dfsg.1-5), gcc-4.4 ( <4.4.6-4), gcc-4.5 ( <4.5.3-2), gcc-4.6 ( <4.6.0-12), libhwloc-dev ( <1.2-3), libjna-java ( <3.2.7-4), liblouis-dev ( <2.3.0-2), liblouisxml-dev ( <2.4.0-2), make ( <3.81-8.1), pkg-config ( <0.26-1) Homepage: [url]http://www.gnu.org/software/libc/libc.html[/url] Tag: devel::lang:c, devel::library, implemented-in::c, role::devel-lib, suite::gnu Build-Essential: yes Download-Size: 2*366 kB APT-Manual-Installed: no APT-Sources: [url]http://mirror.yandex.ru/debian[/url] testing/main amd64 Packages Description: библиотеки для разработки и заголовочные файлы для GNU C Содержит символические ссылки, заголовочные и объектные файлы, необходимые для компиляции и линковки программ, использующих стандартную библиотеку C.

Источник

GCC fatal error: stdio.h: No such file or directory

I’m trying to compile a program in C on OS X 10.9 with GCC 4.9 (experimental). For some reason, I’m getting the following error at compile time:

gcc: fatal error: stdio.h: No such file or directory 
#include int main(int argc, const char *argv[])

Again, upon running gcc -o ~/hello ~/hello.c , I got the same error. I’m using an experimental version of gcc , but it seems implausible that there would be a release which generated errors upon importing stdio . What could be causing this issue, and how can it be fixed?

You can see where gcc is looking for header files by doing echo «#include » | gcc -v -x c — and examining the search paths.

Mavericks no longer has a base /usr/include. You need to link it into place from the XCode OS 10.9 SDK.

@user2615799 Its at sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /usr/include

5 Answers 5

macOS

I had this problem too (encountered through Macports compilers). Previous versions of Xcode would let you install command line tools through xcode/Preferences, but xcode5 doesn’t give a command line tools option in the GUI, that so I assumed it was automatically included now. Try running this command:

If you see an error message that developer tools are already installed (and still header files can’t be found), wipe out any existing one to do a fresh installation:

sudo rm -rf /Library/Developer/CommandLineTools 

Ubuntu

sudo apt-get install libc6-dev 

Источник

error: stdio.h: No such file or directory error during make

I’m trying to compile the following program in Ubuntu. But I keep getting the error: «stdio.h: No such file or directory» error.

obj-m += hello.o all: make -I/usr/include -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean 

3 Answers 3

Your way of building your program is the way to build kernel module and not c program application. and stdio.h does not exist in the environment of the kernel development so that’s why you get the error:

error: "stdio.h: No such file or directory" error 

1) If you want to build a linux application then your Makefile is wrong:

You should modify your Makefile

Use the following Makefile:

all: hello test: test.c gcc -o hello hello.c clean: rm -r *.o hello 

2) If you want to build a kernel module then your c code is wrong

  • YOU CAN NOT use stdio.h in the kernel space development. Itdoes not exist in the environment of the kernel development so that’s why you get the error
  • YOU CAN NOT use main() in the kernel module C code
  • YOU CAN NOT use printf() in the kernel module C code

INSTEAD of using stdio.h , you have to use the following include

#include /* Needed by all modules */ #include /* Needed for KERN_INFO */ 

INSTEAD of using int main() < , you have to use

INSTEAD of using printf() use printk()

Use the following hello module instead of your hello code

/* * hello-1.c - The simplest kernel module. */ #include /* Needed by all modules */ #include /* Needed for KERN_INFO */ int init_module(void) < printk(KERN_INFO "Hello world 1.\n"); /* * A non 0 return means init_module failed; module can't be loaded. */ return 0; >void cleanup_module(void)

Please refer to the following link for more detail about kernel module development

Источник

Linux Mint Forums

Forum rules
There are no such things as «stupid» questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 5:29 am

Hello,
I’m learning C on my Mint 17.2 Cinnamon 64 bit, but for some reason gcc cannot find the stdio.h header file.
This is the error I get —

kabir@kabir-G50-80 ~/Programming/C $ gcc helloworld.c -o hello
helloworld.c:1:19: fatal error: stdio.h: No such file or directory
#include
^
compilation terminated.

And here is the program I want to compile —

I can’t see where I’ve gone wrong. Any help regarding this would be very helpful.
Thanks!

PS: I was under the impression that all these header files came preinstalled in mint as I didn’t face this problem when I was learning C on ubuntu. I checked /usr/include and couldn’t find stdio.h unless it is located in some other folder or sub folder.

Re: Cant find stdio.h header file

Post by xenopeek » Sat Sep 19, 2015 5:37 am

Image

Re: Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 5:40 am

Do I have to install build-essentials? I thought all these header files that gcc requires to compile came pre-installed?

Re: Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 5:43 am

I just found stdio.h installed in this path —
/usr/lib/syslinux/com32/include/stdio.h

How do I instruct gcc to pick the header file from this path?
Thanks!

Re: Cant find stdio.h header file

Post by xenopeek » Sat Sep 19, 2015 5:46 am

Image

Re: Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 6:39 am

My apologies. I did not intend to refute you. I was only curious as to why gcc doesn’t recognize stdio.h from the path — /usr/lib/syslinux/com32/include

Since I’m new here, and I do not know much of the Linux file system and the logic behind it and neither do I know much of C or GNU, which is probably why I was curious.

Installing build-essentials has fixed this problem, and I thank you for that, however I would still like to know why installing build-essentials is important when stdio.h exists in the path I listed above (/usr/lib/syslinux/com32/include). Again, I’m just curious but I will go read about this on Google.

Forgive me if my question was stupid, ignorant or a test of your patience.

Re: Cant find stdio.h header file

Post by xenopeek » Sat Sep 19, 2015 6:59 am

Not a stupid question, but yes you need build-essential (no s at the end) to get the complete gcc compiler stack installed. That’s standard across all Debian and Ubuntu based distros.

The stdio.h file you found comes from a syslinux package, which is a collection of boot loaders. I don’t know what it’s for but likely a minimal implementation of stdio for use in the resource constrained boot loader. This is not the stdio.h file you are searching for

Image

Re: Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 7:30 am

xenopeek wrote: Not a stupid question, but yes you need build-essential (no s at the end) to get the complete gcc compiler stack installed. That’s standard across all Debian and Ubuntu based distros.

The stdio.h file you found comes from a syslinux package, which is a collection of boot loaders. I don’t know what it’s for but likely a minimal implementation of stdio for use in the resource constrained boot loader. This is not the stdio.h file you are searching for

Источник

A new issue: fatal error: stdio.h: No such file or directory

I tried perform find /usr/include/ -name «stdio.h» nothing return. I tried some methods, they can not work, such as:

sudo apt install --reinstall build-essential sudo apt install libc6-dev 

Even I delete the current GCC and install another version GCC. The same issue occurs. My OS information is as shown:

# uname -a Linux LS1028ARDB-Ubuntu 5.4.3-rt1 #1 SMP PREEMPT_RT Wed Jul 21 20:29:03 PDT 2021 aarch64 aarch64 aarch64 GNU/Linux 
# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu Thread model: posix gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) 

Источник

Читайте также:  Etc passwd file in linux
Оцените статью
Adblock
detector