Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
elfin buddy said:
I usually prefer using the command line for working with C files. Xcode is fantastic for making GUI apps, but I just could never figure out a good way to make it compile straight-up C code with no bullsh*t. For the C course I took two years ago, I didn't want .h files or templates with #include <helloworld.h>. I just wanted a blank text file that would compile as C code and display results in another window, without having to create a whole project for it.

I would love to use Xcode for compiling C, but it just seems like overkill. Can anyone suggest a way to make Xcode work that way, or should I stick with the terminal? (I have no beefs with the terminal at all...just looking for other options too)

Create a new project from the C tool project, remove what you don't need and save somewhere else, then, copy it into the project template folder.
 

elfin buddy

macrumors 6502a
Sep 16, 2001
608
0
Tuttlingen, Germany
bousozoku, that seems to have worked very well! I still do have to create a project, but at least there aren't a million little files with weird extensions all over the place :) Also, creating a project is less painful now that there's an option called C Tool there ;) Thanks a lot!
 

bowens

macrumors 6502a
Jun 19, 2006
827
136
Florida
I really liked Kate on Linux, but I haven't been able to find it for OS X. I really liked it because it had the terminal right there in the editor. I didn't have to switch windows back and forth to try out a change to my program. Does anyone know if it is available for OS X? Anyway, jEdit seems to be a pretty good cross-platform editor.
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
elfin buddy said:
bousozoku, that seems to have worked very well! I still do have to create a project, but at least there aren't a million little files with weird extensions all over the place :) Also, creating a project is less painful now that there's an option called C Tool there ;) Thanks a lot!

You're welcome. You can create a few project templates that you would re-use often. It's always helpful to keep certain libraries connected and then, add in the extra pieces you need later.

It's always nice when your work environment is streamlined. :)
 

weg

macrumors 6502a
Mar 29, 2004
888
0
nj
macbookpro10 said:
What is the best C editor? Thanks.

Never ever ask this question when UNIX folks are around!
Well, you're in a forum where people use Mac OS X, so I guess it's too late..

Let's start the vi (comes with every Mac) vs. Emacs
war begin ;-)

With respect to best compiler: That's probably the Intel C++ compiler, since it supports OpenMP and therefore allows you to optimize your Code for the Core Duo. However, since you obviously need the compiler for an introductionary course, ANY compiler will do, and, as many others mentioned before, gcc comes for free with XCode (which you probably got with your Mac on the CD with additional programs, but it's better to download the newest version for free).
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,566
macbookpro10 said:
Hey guys. Maybe you can help me out. I signed up for a C Programming course for college. The teacher has no idea about macs and said to use the terminal. I need a stable free C/C++ Compiler. The one he recommends for XP is http://www.bloodshed.net/devcpp.html (DEV C++) but it doesn't come for OSX. Can someone help me out so I can have a visual Run/Compile/Save application compatible for C and C++. Thanks again.
Joe

Why don't you just use the compiler and the development system that Apple uses to build absolutely everything that your Macintosh ships with? That would be XCode then.
 

savar

macrumors 68000
Jun 6, 2003
1,950
0
District of Columbia
macbookpro10 said:
Hey guys. Maybe you can help me out. I signed up for a C Programming course for college. The teacher has no idea about macs and said to use the terminal. I need a stable free C/C++ Compiler. The one he recommends for XP is http://www.bloodshed.net/devcpp.html (DEV C++) but it doesn't come for OSX. Can someone help me out so I can have a visual Run/Compile/Save application compatible for C and C++. Thanks again.
Joe

I think you're confused. DEV C++ is an IDE, not a compiler. IDE=Integrated Development Environment. Usually that might include a source code editor, a way to execute the compiler from within the graphical environment, visual debugger, and SCM (source code management) interface. It used to be that all of these tools were available only separately. You'd run a text editor (like vi), then you'd close out of that and run the compiler. If the code didnt' work you'd run the debugger. Then when everything was good you'd run SCM to check in your code. Nowadays (actually the last 20-30 years probably), all of these tools can be accessed from within one application, called an IDE.

Now then, as an IDE, DEV C++ doesn't actually compile code. It also probably doesn't actually do any debugging or SCM -- it is just a text editor with front ends to all of those programs that make them conveniently accessible and often easier to use. If you read their web page, they compiler they ship with is GCC.

bloodshed.net said:
Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.

Now, GCC is an open source compiler that happens to be pretty good. It's not a speed demon, but it has lots of features and runs on a dizzying array of heterogenous platforms. If you learn gcc you will learn to operate in a lot of environments. GCC is, of course, included with OS X. In fact, it is included with most unix or linux style operating systems.

Are you a comp-sci major? Or is this intro to programming for non-majors? The reason that I ask is if you are a major, you should not be learning to develop in an IDE using a visual debugger, etc. You should be learning how code is actually compiled and linked, and an IDE glosses over all those details. Furthermore, I can't imagine why a university professor is suggesting his students pay for a small-time IDE when there are free IDEs out there that are probably much better. Even the name -- bloodshed -- seems inappropriate for a professor to be asking his students to download it.

Long and short of it: think about looking for a new prof. This doesn't know anything about macs, he's already confused you about the difference between an IDE and compiler (or he's confused himself). I don't think you're going to get much out of a class like that.
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
weg said:
Never ever ask this question when UNIX folks are around!
Well, you're in a forum where people use Mac OS X, so I guess it's too late..

Let's start the vi (comes with every Mac) vs. Emacs
war begin ;-)

With respect to best compiler: That's probably the Intel C++ compiler, since it supports OpenMP and therefore allows you to optimize your Code for the Core Duo. However, since you obviously need the compiler for an introductionary course, ANY compiler will do, and, as many others mentioned before, gcc comes for free with XCode (which you probably got with your Mac on the CD with additional programs, but it's better to download the newest version for free).

emacs comes with the developer tools so it's as available as vi. It's a bit easier to use, though, especially since these days it has menus.

Xcode is nice but it's a little daunting for people new to programming.
 

Attachments

  • Picture 1.png
    Picture 1.png
    22.6 KB · Views: 138

Palad1

macrumors 6502a
Feb 24, 2004
647
0
London, UK
remember, with emacs,
Control X then control S : saves
Control x then control f : open a file
control x then control c : close emacs
control s then type something : search for 'something' in the current file.

When nothing seems to respond: control-g

Emacs is a bit hard for a newbye, I think XCode or textwrangler are still the best options.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.