How to program in C on Mac Leopard without XCode IDE? - c

I have just come to Mac world from Linux world and I love my way around in Mac environment. I want to write and practice simple C programs in mac and I was searching for the tools I require. Most (All) of the resources in the web ask me to use XCode as IDE to do programming in C on Mac. XCode, for my purpose seems to be an overkill. I am in no way interested in developing iPhone or Mac GUI application. All I want is
enter C programs using a text editor,
compile it ,
and get the output in a Console.
How can I do it ?
Thanks.

the 3 steps you give are simply the answer already:
use text editor of choice
use eg Terminal and compile on command line (simply using gcc, or cmake/make or so for more complex programs)
run program on console

Just use gcc.

Your could also use XCode to compile simple command line tools.
Start XCode
File -> New Project
Mac OS X -> Application -> Command Line tool
XCode has a really nice syntax highlighting and code completition and gdb integrated.

Follow on from PatrickS's answer - I didn't read the original question clearly, but personally - other than following a couple of ObjC tutorials - the only time I've used XCode is AS a C IDE.
The feedback on compile errors is neat (visually integrated into the IDE rather than having to match lines from the compiler output), and getting better (due to integration with the underlying clang project).

Related

C Programming with Cygwin and gdbtui

my question is regarding to the use of Cygwin and gdb. I was working on a school project but they want me to practice without the use of Visual Studio or similar compilers.
My questions is.. How would I be able to code C? Would this be on a text program or on Cygwin itself?
Thank you.
The Code::Blocks IDE may arguably be considered too close to Visual Studio, but until you learn the in's and out's of it, it's really just a place to write and compile code. You can keep to the spirit of the request by just using it as such rather than digging into its full capabilities.
If you really need to do it from scratch, use any text editor (eg: Notepad) and manually compile like this: http://ce.uml.edu/compile.htm
You can write program using any good text editor like this.
If you have cygwin installed on your system then you can just add c/c++ compiler (like gcc) to it and compile the program.
You always need not to use IDE for writing and compilation of programs.
Even though #Dinah does answer your question we still have not discussed about the way to use the gdb debugger .
Since you are starting out new i suggest you master debugging using a debugger like gdb . Believe me you will save tonnes of time figuring out what went wrong using print statements ( or any other equivalent mechanisms )
Here is a good place where you can start learn to use gdb
Have fun!

Is there an IDE that works with CUDA on mac osx lion?

I'm trying to learn Cuda and its very interesting but I'm having problems creating code without a bit of help from an IDE. I know Java/Python but I'm unfamiliar with C/C++ so I have been using eclipse and Xcode to help me with commands and finding things(via code code completion). I can't seem to get these options for CUDA?
I have seen examples and can build them find(nvcc is working) but without the IDE to help catch some of my mistakes I'm a bit lost editing the code in just a text editor. I found a toolkit plugin for eclipse but although it seems to install I think its for a older build of eclipse because most of the options in the instructions do not match my version(Indigo). Nvidia has a plugin for Visual studio only on their site(I'd rather not install windows on my mac to use Cuda).
I'm sorry if this sounds bad but I'm curious to how people are developing cuda on Mac's. I don't care what IDE I use as long as it helps me see the options and warn me if I have syntax issues,etc..(I'm not the best programmer but switching IDE's for me has just been a matter of finding out where things are so I'm really fine with any solution as long as it helps me as I'm learning).
Nsight Eclipse Edition is available as a part of the CUDA Toolkit 5.0 (no additional download required).
Qt Creator!
You can read Qt Creator + CUDA + Linux for inspiration on how to setup the build environment on Mac OS X.
You could think about using JCuda:
http://www.jcuda.de/
There is XCode plug-in for CUDA development. I found it there. There is the main discussion on nvidia.com
Visual Studio Code + this extension:
https://github.com/gangliao/VS-Code-Cuda.
For me, Visual Studio Code is my favorite IDE for every language I found out there

Any way of running GTK libraries In Windows OS using C?

After a whole week of trying to get GTK working on Cygwin and MinGW using makefile, I've hit a stone cold wall. Does anyone please, anyone know how I can program using C and GTK libraries in widows operating system that WORKS? If there is can anyone give me step by step instructions please! The environment has to run the hello world program as an example: http://en.wikipedia.org/wiki/GTK%2B
Thanks in advance!
It's a bit tricky to configure GTK+ toolchain on Windows.
The easiest way is to use this GTK+ bundle. It provide easy to use and install GTK+ runtime environment. You will find there note how to extend this runtime for developing purposes.
According to GTK+'s mailing list version 2.16 is known to be the most stable, however maybe it's good idea to try newer one.
Moreover go to GTK+'s home page and read threads about GTK+ & Windows 7 on the gtk-app-devel mailing list.

which development software should be used for VLC on mac?

i want to do some modification and development for VLC. i download its source code, vlc-1.1.5. and it is written by C. so usually which development environment should i use, xcode or some others?
thx...
I thought VLC was developed in Qt. Do you see the class names starting with Q? In case it is developed in Qt, Qt Creator or KDevelop would be a good choice of development environment.
The VideoLAN folks provide a wiki page with information about compiling their source on multiple platforms. The page relevant to OS X is here: http://wiki.videolan.org/OSXCompile
Compiling VLC media player on Mac OS X is different from normal linux compiling and OS X compiling. We do not use Xcode, but a simple ./configure and then make isn't enough either.
The page provides a step-by-step guide to setting up a machine running either OS X 10.5 or 10.6.
Any editor of choice should suffice. Looking at the code, it seems that VLC uses Unix-style building (autotools, make, etc). On Win32, it uses MinGW, so plain old gcc and make is probably used on OSX as well.

Is there an easier way to type and compile C on Mac OS X?

I've just started learning C on Mac OS X. I have downloaded Xcode too.
So far, I have been typing my apps into TextEdit, and then using the Terminal to locate my apps and compile them using gcc hello.c etc.
Is there an easier way (using Xcode perhaps?) to type my code into some form of IDE, and then automate the compiling with a 'compile and run' button or similiar? It seems a bit primitive and tedious using TextEdit and then switching to the Terminal to compile. However, I do not have much experience with lower level languages like C, so I'm unsure if it is even possible.
Thanks
Yes that is what XCode is for.
Look at the tutorial on the open screen of XCode (version 3.2.1 for OSX 10.6) This is for objective C but the tools are the same.
Or if the objective C is confusing choose a new project from XCode. File->New Project) choose command line tool as the project type and then choose type as C from the pop up menu
Xcode will definitely be easier, although for a "hello world"-type project like yours, its advantages may not be obvious. Install it, fire it up, and leave TextEdit behind ...
OTOH, you could edit your source code in vi or emacs (in Terminal), which would avoid having to flip between Terminal and TextEdit. BTW, this is the way development used to be done ...
Use XCode, you already have it. :)

Resources