PDA

View Full Version : C programming in OSX




SuperMiguel
Jun 6, 2012, 02:09 PM
So im trying to do some heavy/fast C programming in OSX, need to have a simple/fast editor..

Been using Vim for a bit, but want to try something else just to see if its faster a friend recommend using Textmate.. It looks good ut when i try to run C programs that needs to have input from the user it doesnt work...

I just get the HTML output but it never ask me to input values...

is there a way to make scanf work in text mate?
Thanks



larswik
Jun 6, 2012, 02:21 PM
Those programs are just fancy text editors. I use sublime 2 when I write some PHP code. But when I test the code I use XAMPP to just test my PHP code. For C I use Xcode since you can compile and test that software. You need to be able to compile and run your programs and text editors can not do that as far as I know.

If you have not paid the $99 annual fee then you will have to buy Xcode for like $5 at the app store.

SuperMiguel
Jun 6, 2012, 02:42 PM
Is there a good guide on using Xcode for c development???

balamw
Jun 6, 2012, 02:52 PM
If you have not paid the $99 annual fee then you will have to buy Xcode for like $5 at the app store.

Actually I think the $5 was a temporary thing. Now that Lion and Xcode are released I see Xcode as free even from my 10.6 box.

You might also consider using Eclipse (http://www.eclipse.org/) as an IDE.

B

larswik
Jun 6, 2012, 03:02 PM
Is there a good guide on using Xcode for c development???

How good are you at C, are you new? I would think that if you have programmed in C then you would already have programs like Xcode or Eclipse that balamw mentioned to compile your code? or perhaps you are coming from another platform?

The book "Learn C on the Mac" walks you through C programming and uses Xcode as the tool to write code with.

SuperMiguel
Jun 6, 2012, 03:58 PM
How good are you at C, are you new? I would think that if you have programmed in C then you would already have programs like Xcode or Eclipse that balamw mentioned to compile your code? or perhaps you are coming from another platform?

The book "Learn C on the Mac" walks you through C programming and uses Xcode as the tool to write code with.

Not now, been using linux to program using vim, i tried eclipse and i find it very slow..

AlanShutko
Jun 6, 2012, 04:02 PM
You want a text editor with an embedded shell. They aren't as common now that fewer people are writing shell programs. Eclipse, as mentioned, also Emacs. Looks like BBEdit can do it as well.

SuperMiguel
Jun 6, 2012, 04:34 PM
You want a text editor with an embedded shell. They aren't as common now that fewer people are writing shell programs. Eclipse, as mentioned, also Emacs. Looks like BBEdit can do it as well.

i find eclipse to be a bit weird with the workspace interface, and it takes a long time to build as well..

ArtOfWarfare
Jun 6, 2012, 04:47 PM
Personally, I use gedit to write my code, and then compile/run it using terminal. (Granted, this is just when I'm writing a command line tool in C or C++, which I only ever do for schoolwork. If I'm writing an actual app, I use Xcode.)

ScoobyMcDoo
Jun 6, 2012, 05:00 PM
I use Netbeans for doing extended C/C++ development work. For doing quick edits during debug, I'll usually just pop up a vi session.

SuperMiguel
Jun 6, 2012, 06:42 PM
I use Netbeans for doing extended C/C++ development work. For doing quick edits during debug, I'll usually just pop up a vi session.

just tryied netbeans and it looks cool :_)

is it well supported within the C community?

Mr. Retrofire
Jun 6, 2012, 07:17 PM
So im trying to do some heavy/fast C programming in OSX, need to have a simple/fast editor...
I write/edit my C code in BBEdit, and use Xcode or the GCC (including Clang and LLVM) for the other work. The Xcode code editor is not reliable enough and Apple changes the Xcode code editor from version to version. Not what i want. I want to solve problems in my code, not in the IDE.

ScoobyMcDoo
Jun 7, 2012, 08:38 AM
just tryied netbeans and it looks cool :_)

is it well supported within the C community?


uhm... I don't really know about support within the C community. I've been using it for C/C++ for probably 4 or 5 years. They constantly update the C/C++ language plugin. When I was doing just pure linux stuff I used KDevelop, but ended up needing and IDE that ran on multiple OS's. I tried eclipse first - at the time it's C/C++ parsing engine was painfully slow - I think it's gotten better. The Netbeans parser at the time was really fast compared to eclipse, so I chose netbeans. They have had a few releases where the parser has gotten worse, but it's current state is pretty dang good - and since I am now accustomed to all the keyboard shortcuts, it feels way to familiar to start switching again.

One thing I really like about netbeans is it's ability to import a makefile based project. Where I work, everyone uses a different editor/IDE, so we use the least common denominator of makefile projects. With netbeans, I can check out the source from CVS (yes we still use cvs), and do the import into a netbeans project with just a few clicks. Eclipse is a real pain in the ass when it comes to doing the same import.

KDevelop was pretty good for doing the import also. I used it back in the version 3.x era - they were getting that IDE to a point that it was pretty good and feature rich - just needed a bit more work to get it to be a great IDE. At that point they decided to throw everything away and start from scratch. I've tried version 4.x, and it's fairly solid, but since they decided to start from scratch, they lost a lot of features that will take years to put back.