Complete newbie cc question.

Lazarus18

In debt medical student
OK, so this is the most basic of basics, but I'm trying to defend OSX's honor here. My girlfriend works on Redhat Linux and I asked her to write some really simple C so I could show her that she could do her coding (she's an astronomy grad student and all the stuff she writes relates to that).

For starters when she typed emacs she didn't get what she expected. I saw her do it on her Linux box and this window popped up that allowed her to select menus and such with the mouse. No such thing in the terminal. What was that?

Secondly, what she wrote couldn't be compiled on my OSX system. It's possible she wrote it wrong, she's not really a programmer by trade, but it seemed pretty basic. When I try to cc this I get:

/usr/bin/ld: /usr/lib/libSystem.dylib load command 6 unknown cmd field

The code is as follows:
#include ,stdlib.h. (If I actually put in the brackets the bulletin board removes the text thinking it's HTML. Imagine I had pressed shift.)
int main ()
{
printf("\nHello, world.");
return;
}

What's wrong here? I thought there should be no differences between Linux and OSX when it comes to writing in C. If there are my arguments for her moving to OSX are null and void.
 

jdog

Not a Moderator
I see people reporting this error a lot now. I don't know what it is referring to. Do you have the Dev Tools installed? Also, I don't think emacs has a OSX port (yet), other than using xfree86 + emacs, but I could be wrong. She can however use project builder to code her programs, it has cool features like syntax highlighting, etc. Anything she codes in ANSI C will translate to OSX without a problem. Things that use GUI elements will be a problem (unless she uses Tk, as it has been ported to OSX).

As far as the code, try this:

#include ,stdio.h,

int main(void)
{
printf("\Hello OSX\n");
return 0;
}

I don't know why she is using stdlib.h instead of stdio.h, as the printf() function is included in the stdio header.

-jdog
 

jimr

McInstigator
Originally posted by Lazarus18
When I try to cc this I get:

/usr/bin/ld: /usr/lib/libSystem.dylib load command 6 unknown cmd field

The code is as follows:
#include ,stdlib.h. (If I actually put in the brackets the bulletin board removes the text thinking it's HTML. Imagine I had pressed shift.)
int main ()
{
printf("\nHello, world.");
return;
}

What's wrong here? I thought there should be no differences between Linux and OSX when it comes to writing in C. If there are my arguments for her moving to OSX are null and void.
you are right, there is no difference... and just like linux you need to have the correct tools to do the job.

you are using the wrong dev tools.

Download the current 10.1 dev tools from
apple developer connection

If you are not a member join the free program and you will get a password and the access to the 180 megabytes of compiling bliss on OSX10.1

then you can have somuch fun writing Hello world in the console.

emacs as she experiences it requires X-windows. Linux does not have a killer GUI engine called Quartz. if you like you may install Xfree86 by several different methods and run all kinds of things that linux knows how to do.

No KDE but Gnome and enlightenment and Xemacs

In the meantime, judging a machine based on it's ability to run a word processor is what make Windows the #1 PC platform in terms of sales.

the terminal app is just a dumb terminal but it could be programmed to interact better with the gui, but then if you were going to do that, it is easy to make a regular gui app which interacts with the Unix layer.

who needs it if you have BBEdit.

I have Nedit too on Xwindows.

Anyway, Linux and Windows snobbishness is only the first rung of the ladder compared to full-fledged Mac-elitism....

get the Devtools and she'll want to move in with you...
 

beef

Dinner
i remember using emacs on xterm instead of xemacs... hmm... I forgot why...

in any case... when you have bbedit... there really isn't a need for xemacs...

and emacs on terminal does have menu, etc... you just don't click on it with mouse...
 

AdmiralAK

Simply Daemonic
emacs with menus :p
Bah! ... In my days (well now) we use emacs on the terminal, no mouse and point and click like you youngins (well older than I if she is a grad student :p)... A real programmer uses control-x control-s to save, and other such commands to navigate emacs ;)

Of course I am being comical and not getting on your case :)
But I do use the terminal version of emacs all the time when I code.



Admiral
 

theed

Registered
The bad thing about getting used to command line emacs is that ^x^s doesn't do a thing in TextEdit! :) What a horrible convention. ... and don't even get me started on
"^y did they choose that for the paste key?"

If you _want_ emacs, the command line version is what's there. But really, break out the dev tools, open up a new project - Tool - c++ tool ... and give that puppy a name.

the default hello world app is already there.

hammer means make. terminal with hammer means make and run. If you can't figure out the rest, read something. :)
 

mrjohns

Registered
Hey whats all this talk about emacs or BBEDIT.... vi or its smarter brother vim is what all good UNIX people use. mmmmmmmm comand line editing mmmmmmm
 
Top