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!
asked Jul 17, 2017 at 21:25
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.
answered Oct 1, 2017 at 11:58
salafisalafi
5866 silver badges5 bronze badges
2
Run:
sudo apt install --reinstall gcc-5.4
This reinstalls gcc
. Reinstalling sometimes fixes problems.
fosslinux
3,7413 gold badges27 silver badges46 bronze badges
answered Jul 18, 2017 at 2:04
0
Install missing library:
sudo apt install libc6-dev
answered Jan 29, 2021 at 16:15
Going into the C/C++ Configurations and adding /usr/include/**
fixed it for me.
answered Aug 25, 2021 at 19:58
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.
answered Mar 21, 2022 at 2:07
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
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
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
answered Nov 22, 2013 at 16:55
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
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
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
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
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
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
answered Nov 22, 2013 at 16:55
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
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
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
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
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
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
answered Nov 22, 2013 at 16:55
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
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
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
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
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!
asked Jul 17, 2017 at 21:25
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.
answered Oct 1, 2017 at 11:58
salafisalafi
5866 silver badges5 bronze badges
2
Run:
sudo apt install --reinstall gcc-5.4
This reinstalls gcc
. Reinstalling sometimes fixes problems.
fosslinux
3,7413 gold badges27 silver badges46 bronze badges
answered Jul 18, 2017 at 2:04
0
Install missing library:
sudo apt install libc6-dev
answered Jan 29, 2021 at 16:15
Going into the C/C++ Configurations and adding /usr/include/**
fixed it for me.
answered Aug 25, 2021 at 19:58
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.
answered Mar 21, 2022 at 2:07
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
Shadevskiy 5 / 5 / 11 Регистрация: 25.01.2015 Сообщений: 205 |
||||
1 |
||||
29.04.2017, 01:04. Показов 9924. Ответов 2 Метки нет (Все метки)
Ради всего доброго, скажите, что нужно сделать?! Этот Линукс меня скоро убьет. Я разбираюсь с чем-то одним — тут же возникает что-то другое. Ох, какое счастье, что люди додумались до IDE, а не используют терминалы.
__________________
0 |
Max Dark шКодер самоучка 2173 / 1880 / 912 Регистрация: 09.10.2013 Сообщений: 4,135 Записей в блоге: 7 |
||||||||
29.04.2017, 01:14 |
2 |
|||||||
РешениеShadevskiy, попробуйте установить
2 |
gng 921 / 638 / 198 Регистрация: 08.09.2013 Сообщений: 1,693 |
||||
29.04.2017, 07:40 |
3 |
|||
Решение
Ох, какое счастье, что люди додумались до IDE Дествительно, среда научила бы вас отступам при написании кода. Но libc6-dev она бы за вас не установила.
Пробовал через Synaptic переустановить gcc — увы Если вы бы это сделали в терминале утилитой apt-get, то получили бы подсказку
PS. То, что libc6-dev не прописан в зависимостях gcc — вопрос, действительно, спорный.
1 |