- Turbo C
- Compiler For C Language
- Text Editor And Compiler For C Mac X
- C Editor And Compiler For Windows
- Text Editor And Compiler For C Mac Os X
I've actually tried and downloaded a lot of the suggested IDE's related to C++, but I can't find anyone that will properly run a practice program. At school we use Visual Studios, but I obviously can't use that at home since I have a Mac. I am looking for something that I can use at home for homework and projects, etc. I have downloaded: CodeBlocks, Sublime Text, Xcode, and Eclipse CDT, and I have input my practice program and I cannot figure out at all how to even get it to run. I got the terminal to at least open on Xcode, but it was not a proper output.
Chris Lattner and his compiler team were well known to be big fans of C++. Many of the low-level libraries in OS X, especially audio and I/O are written in C and C++.
I am learning C for a class at my university and wish to write the program using the TextWrangler text editor on my Mac (running OSX Lion 10.7). Once I write the .c file, I compile it using gcc. I downloaded the compiler from Apple Developer Tools.
It is included in a command line tools download. I locate the file using Terminal, compile it using gcc filename.c where the a.out executable file is created. However, when I type 'a.out' or '/a.out' I get the following messages: '-bash: a.out: command not found' or '-bash: /a.out: No such file or directory'. I have successfully compiled and ran C programs on Linux systems before using this same method. What am I doing wrong on my Mac?
AstroCB6 Answers
You need to add a dot to indicate that the executable is in the current directory, as the current directory is not in the path:
MByDMByDYou're just missing one thing!Instead of '/a.out' it should be './a.out'. Another useful thing is changing the output so that you can have multiple compiled programs. Simply, the only thing you need to put in the terminal is the following (fill in the blanks with what you would like)
good luck!
beckahbeckahYou have to add a dot in front of the slash:
/a.out
would try to execute a program in the root folder (/
).a.out
will look for your program in all the folders defined in the PATH environment variable.
I have successfully compiled and ran C programs on Linux systems before using this same method. What am I doing wrong on my Mac?
You have to do the same on Linux.
DrummerBDrummerBmake sure to set your permissions executable with chmod +x a.out
Turbo C
MichaelMMichaelMYou'll need a compiler. The easiest way however is to install XCode. This way you'll get access to 'gcc', Thus,
Compiler For C Language
Then run it like this.
Text Editor And Compiler For C Mac X
Hope this helps!.