bxsci(macuser) Posted May 14, 2007 Share Posted May 14, 2007 i have next to no expiriance in programming so i could really use some help here... i typed in the hello world program to Xcode #include <stdio.h> int main(void) { printf("Hello world!"); return 0; } that... and then i compiled using terminal ( cc -c hello.c) and i got hello.o which seemed fine - but then how do i execute the file from there? Link to comment https://www.insanelymac.com/forum/topic/51071-need-help-with-c/ Share on other sites More sharing options...
np101137 Posted May 14, 2007 Share Posted May 14, 2007 compile with this command: gcc hello.c You will get a file called a.out run that in terminal, you should be fine Link to comment https://www.insanelymac.com/forum/topic/51071-need-help-with-c/#findComment-365548 Share on other sites More sharing options...
Superhai Posted May 14, 2007 Share Posted May 14, 2007 you should also link it, you could skip the -c option and add -o filename to make an executable named filename. Link to comment https://www.insanelymac.com/forum/topic/51071-need-help-with-c/#findComment-365553 Share on other sites More sharing options...
bxsci(macuser) Posted May 15, 2007 Author Share Posted May 15, 2007 thanks Link to comment https://www.insanelymac.com/forum/topic/51071-need-help-with-c/#findComment-365567 Share on other sites More sharing options...
asap18 Posted May 15, 2007 Share Posted May 15, 2007 if you pick the C standard tool option when you make a project in xcode. There is a Build & Run option which will automatically compile and execute the program in a nice terminal window. Link to comment https://www.insanelymac.com/forum/topic/51071-need-help-with-c/#findComment-365656 Share on other sites More sharing options...
Recommended Posts