Whenever I run $ /developer/usr/bin/gcc -v main.c -o main in Terminal, I get the following error: stdio.h: No such file or directory.
Here is the main.c file
#include <stdio.h>
int main(void){
int i;
for(i = 0; i<10;i++){
puts("Hello World!\n");
}
return 0;
}
I am pretty good with C, however I usually use xcode to compile any C command line programs. The same code runs fine in Xcode, what am I doing wrong?
I had the same problem and fixed it. Just install xCode's command line tools and it'll all work just fine!
Hope it helps! :)
You can install xcode tools with the command -
xcode-select --install
A fresh install of xcode command line tools will require 130MB of space and does require sudo access.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.