Linux fatal error stdio h нет такого файла или каталога

gcc worked perfectly fine until I updated to Ubuntu 16.04 and now when I run: gcc file.c an error shows up: file.c:1:18: fatal error: stdio.h: No such file or directory compilation terminated. I

gcc worked perfectly fine until I updated to Ubuntu 16.04 and now when I run:

gcc file.c

an error shows up:

file.c:1:18: fatal error: stdio.h: No such file or directory
compilation terminated.

I checked if stdio.h was there and it still was in /usr/include/stdio.h. Please help!

BeastOfCaerbannog's user avatar

asked Jul 17, 2017 at 21:25

Camden's user avatar

0

First run:

find /usr/include/ -name "stdio.h"

If no files are returned, run:

sudo apt install --reinstall build-essential

That will reinstall any missing files.

BeastOfCaerbannog's user avatar

answered Oct 1, 2017 at 11:58

salafi's user avatar

salafisalafi

5866 silver badges5 bronze badges

2

Run:

sudo apt install --reinstall gcc-5.4

This reinstalls gcc. Reinstalling sometimes fixes problems.

fosslinux's user avatar

fosslinux

3,7413 gold badges27 silver badges46 bronze badges

answered Jul 18, 2017 at 2:04

Just Another Person's user avatar

0

Install missing library:

sudo apt install libc6-dev

answered Jan 29, 2021 at 16:15

TOUDIdel's user avatar

Going into the C/C++ Configurations and adding /usr/include/** fixed it for me.

BeastOfCaerbannog's user avatar

answered Aug 25, 2021 at 19:58

Ryan C's user avatar

1

Go to the View tab if you are using VSCode. Search for C/C++ edit configuration(UI). Copy/paste these paths to the include path section of the configuration.

/usr/include/
/usr/include/x86_64-linux-gnu
/usr/include/linux
/usr/include/c++/9/tr1
/usr/include/c++/9

You have to paste these paths.

Save your .c file and run it as gcc /path in terminal.

BeastOfCaerbannog's user avatar

answered Mar 21, 2022 at 2:07

Mradul Raj's user avatar

1

It was the same error in Xubuntu 22 in MPLAB. i fix it using

sudo apt-get install avr-libc

answered Aug 22, 2022 at 17:02

Андрей Тернити's user avatar

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

I then tried a simple Hello World program:

#include <stdio.h>

int main(int argc, const char *argv[])
{
    printf("Hello, world!");
    return 0;
}

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?

asked Oct 25, 2013 at 3:48

Jules's user avatar

JulesJules

14k13 gold badges54 silver badges99 bronze badges

13

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:

xcode-select --install

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

(as per this answer)

sudo apt-get install libc6-dev

Alpine Linux

(as per this comment)

apk add libc-dev

Jongwook Choi's user avatar

answered Nov 22, 2013 at 16:55

amos's user avatar

amosamos

4,9424 gold badges32 silver badges42 bronze badges

6

Mac OS Mojave

The accepted answer no longer works. When running the command xcode-select --install it tells you to use «Software Update» to install updates.

In this link is the updated method:

Open a Terminal and then:

cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg

This will open an installation Wizard.

Update 12/2019

After updating to Mojave 10.15.1 it seems that using xcode-select --install works as intended.

answered Feb 3, 2019 at 4:10

Samshel's user avatar

SamshelSamshel

9288 silver badges12 bronze badges

4

ubuntu users:

sudo apt-get install libc6-dev

specially ruby developers that have problem installing gem install json -v '1.8.2' on their VMs

answered Mar 26, 2015 at 17:23

equivalent8's user avatar

equivalent8equivalent8

13.5k8 gold badges80 silver badges106 bronze badges

3

I know my case is rare, but I’ll still add it here for someone who troubleshoots it later.
I had a Linux Kernel module target in my Makefile and I tried to compile my user space program together with the kernel module that doesn’t have stdio.
Making it a separate target solved the problem.

answered May 4, 2020 at 19:57

Soid's user avatar

SoidSoid

2,4421 gold badge29 silver badges42 bronze badges

I had the same problem. I installed «XCode: development tools» from the app store and it fixed the problem for me.

I think this link will help:
https://itunes.apple.com/us/app/xcode/id497799835?mt=12&ls=1

Credit to Yann Ramin for his advice. I think there is a better solution with links, but this was easy and fast.

Good luck!

answered Oct 25, 2013 at 20:43

nevieandphil's user avatar

1

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

I then tried a simple Hello World program:

#include <stdio.h>

int main(int argc, const char *argv[])
{
    printf("Hello, world!");
    return 0;
}

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?

asked Oct 25, 2013 at 3:48

Jules's user avatar

JulesJules

14k13 gold badges54 silver badges99 bronze badges

13

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:

xcode-select --install

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

(as per this answer)

sudo apt-get install libc6-dev

Alpine Linux

(as per this comment)

apk add libc-dev

Jongwook Choi's user avatar

answered Nov 22, 2013 at 16:55

amos's user avatar

amosamos

4,9424 gold badges32 silver badges42 bronze badges

6

Mac OS Mojave

The accepted answer no longer works. When running the command xcode-select --install it tells you to use «Software Update» to install updates.

In this link is the updated method:

Open a Terminal and then:

cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg

This will open an installation Wizard.

Update 12/2019

After updating to Mojave 10.15.1 it seems that using xcode-select --install works as intended.

answered Feb 3, 2019 at 4:10

Samshel's user avatar

SamshelSamshel

9288 silver badges12 bronze badges

4

ubuntu users:

sudo apt-get install libc6-dev

specially ruby developers that have problem installing gem install json -v '1.8.2' on their VMs

answered Mar 26, 2015 at 17:23

equivalent8's user avatar

equivalent8equivalent8

13.5k8 gold badges80 silver badges106 bronze badges

3

I know my case is rare, but I’ll still add it here for someone who troubleshoots it later.
I had a Linux Kernel module target in my Makefile and I tried to compile my user space program together with the kernel module that doesn’t have stdio.
Making it a separate target solved the problem.

answered May 4, 2020 at 19:57

Soid's user avatar

SoidSoid

2,4421 gold badge29 silver badges42 bronze badges

I had the same problem. I installed «XCode: development tools» from the app store and it fixed the problem for me.

I think this link will help:
https://itunes.apple.com/us/app/xcode/id497799835?mt=12&ls=1

Credit to Yann Ramin for his advice. I think there is a better solution with links, but this was easy and fast.

Good luck!

answered Oct 25, 2013 at 20:43

nevieandphil's user avatar

1

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

I then tried a simple Hello World program:

#include <stdio.h>

int main(int argc, const char *argv[])
{
    printf("Hello, world!");
    return 0;
}

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?

asked Oct 25, 2013 at 3:48

Jules's user avatar

JulesJules

14k13 gold badges54 silver badges99 bronze badges

13

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:

xcode-select --install

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

(as per this answer)

sudo apt-get install libc6-dev

Alpine Linux

(as per this comment)

apk add libc-dev

Jongwook Choi's user avatar

answered Nov 22, 2013 at 16:55

amos's user avatar

amosamos

4,9424 gold badges32 silver badges42 bronze badges

6

Mac OS Mojave

The accepted answer no longer works. When running the command xcode-select --install it tells you to use «Software Update» to install updates.

In this link is the updated method:

Open a Terminal and then:

cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg

This will open an installation Wizard.

Update 12/2019

After updating to Mojave 10.15.1 it seems that using xcode-select --install works as intended.

answered Feb 3, 2019 at 4:10

Samshel's user avatar

SamshelSamshel

9288 silver badges12 bronze badges

4

ubuntu users:

sudo apt-get install libc6-dev

specially ruby developers that have problem installing gem install json -v '1.8.2' on their VMs

answered Mar 26, 2015 at 17:23

equivalent8's user avatar

equivalent8equivalent8

13.5k8 gold badges80 silver badges106 bronze badges

3

I know my case is rare, but I’ll still add it here for someone who troubleshoots it later.
I had a Linux Kernel module target in my Makefile and I tried to compile my user space program together with the kernel module that doesn’t have stdio.
Making it a separate target solved the problem.

answered May 4, 2020 at 19:57

Soid's user avatar

SoidSoid

2,4421 gold badge29 silver badges42 bronze badges

I had the same problem. I installed «XCode: development tools» from the app store and it fixed the problem for me.

I think this link will help:
https://itunes.apple.com/us/app/xcode/id497799835?mt=12&ls=1

Credit to Yann Ramin for his advice. I think there is a better solution with links, but this was easy and fast.

Good luck!

answered Oct 25, 2013 at 20:43

nevieandphil's user avatar

1

gcc worked perfectly fine until I updated to Ubuntu 16.04 and now when I run:

gcc file.c

an error shows up:

file.c:1:18: fatal error: stdio.h: No such file or directory
compilation terminated.

I checked if stdio.h was there and it still was in /usr/include/stdio.h. Please help!

BeastOfCaerbannog's user avatar

asked Jul 17, 2017 at 21:25

Camden's user avatar

0

First run:

find /usr/include/ -name "stdio.h"

If no files are returned, run:

sudo apt install --reinstall build-essential

That will reinstall any missing files.

BeastOfCaerbannog's user avatar

answered Oct 1, 2017 at 11:58

salafi's user avatar

salafisalafi

5866 silver badges5 bronze badges

2

Run:

sudo apt install --reinstall gcc-5.4

This reinstalls gcc. Reinstalling sometimes fixes problems.

fosslinux's user avatar

fosslinux

3,7413 gold badges27 silver badges46 bronze badges

answered Jul 18, 2017 at 2:04

Just Another Person's user avatar

0

Install missing library:

sudo apt install libc6-dev

answered Jan 29, 2021 at 16:15

TOUDIdel's user avatar

Going into the C/C++ Configurations and adding /usr/include/** fixed it for me.

BeastOfCaerbannog's user avatar

answered Aug 25, 2021 at 19:58

Ryan C's user avatar

1

Go to the View tab if you are using VSCode. Search for C/C++ edit configuration(UI). Copy/paste these paths to the include path section of the configuration.

/usr/include/
/usr/include/x86_64-linux-gnu
/usr/include/linux
/usr/include/c++/9/tr1
/usr/include/c++/9

You have to paste these paths.

Save your .c file and run it as gcc /path in terminal.

BeastOfCaerbannog's user avatar

answered Mar 21, 2022 at 2:07

Mradul Raj's user avatar

1

It was the same error in Xubuntu 22 in MPLAB. i fix it using

sudo apt-get install avr-libc

answered Aug 22, 2022 at 17:02

Андрей Тернити's user avatar

Shadevskiy

5 / 5 / 11

Регистрация: 25.01.2015

Сообщений: 205

1

29.04.2017, 01:04. Показов 9924. Ответов 2

Метки нет (Все метки)


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

C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
#include <fcntl.h>
int main()
{
char buffer[100] = "It_was_readed..";
int len;
int fhandle;
char fname[] = "res.txt";
fhandle = open(fname,O_WRONLY|O_CREAT,0600);
write(1,"Vvediten",8);
len= read(0, buffer+16,80);
write(fhandle,buffer,16+len);
close(fhandle);
}

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Max Dark

шКодер самоучка

2173 / 1880 / 912

Регистрация: 09.10.2013

Сообщений: 4,135

Записей в блоге: 7

29.04.2017, 01:14

2

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

Решение

Shadevskiy, попробуйте установить libc6-dev

Bash
1
sudo apt install libc6-dev
Bash
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.



2



gng

921 / 638 / 198

Регистрация: 08.09.2013

Сообщений: 1,693

29.04.2017, 07:40

3

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

Решение

Цитата
Сообщение от Shadevskiy
Посмотреть сообщение

Ох, какое счастье, что люди додумались до IDE

Дествительно, среда научила бы вас отступам при написании кода. Но libc6-dev она бы за вас не установила.

Цитата
Сообщение от Shadevskiy
Посмотреть сообщение

Пробовал через Synaptic переустановить gcc — увы

Если вы бы это сделали в терминале утилитой apt-get, то получили бы подсказку

Bash
1
Recommends: libc6-dev (>= 2.13-5)

PS. То, что libc6-dev не прописан в зависимостях gcc — вопрос, действительно, спорный.
Если бы вы установили, например, пакет g++ вместо gcc, то по зависимостям установился бы libstdc++-dev, который тоже содержит заголовок stdio.h.
С другой стороны, gcc кто-то устанавливает, чтобы компилировать, например, модули ядра, а там stdio.h не нужен.



1



Понравилась статья? Поделить с друзьями:

Читайте также:

  • Linux failed to open file error 2
  • Linux error while loading shared libraries
  • Linux error unable to access jarfile
  • Linux error too many open files
  • Linux error reading lock file

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии