Text Editor And Compiler For C Mac Osx

Archived
  1. Turbo C
  2. Compiler For C Language
  3. Text Editor And Compiler For C Mac X
  4. C Editor And Compiler For Windows
  5. 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++.

15 comments
Active1 year, 1 month ago

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?

MacAstroCBAndCompiler
10.6k14 gold badges50 silver badges66 bronze badges
JT9JT9
4714 gold badges9 silver badges21 bronze badges

6 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:

MByDMByD
120k23 gold badges235 silver badges253 bronze badges

You'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!

beckahbeckah
8874 gold badges18 silver badges48 bronze badges

You 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.

DrummerBDrummerB
36.2k8 gold badges93 silver badges132 bronze badges

make sure to set your permissions executable with chmod +x a.out

Turbo C

MichaelMMichaelM
3051 gold badge3 silver badges14 bronze badges
aFactoriaaFactoria

You'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!.

C Editor And Compiler For Windows

Kent AguilarKent Aguilar

Text Editor And Compiler For C Mac Os X

Not the answer you're looking for? Browse other questions tagged c or ask your own question.