Learning c, need a little help with compiling.

J

jester.dev

I am learning c through an online tutorial currently. And I
am running Linux, but the tutorial does not deal specifically
with linux. I'm not sure if I am compiling correctly or not
because I get errors when running the compiled program when
using: gcc hellow_world.c which created a file called hello.cs.
Now for some reason after deleting hello.cs I only get a file
called a.out when I compile which runs with no problems.

What's with the name a.out? From what I read from another tutorial, I was
supposed to get a file called helloworld that I could run, and not this
a.out file.

Thanks for your time,
Michael
 
C

Christopher Benson-Manica

jester.dev said:
Now for some reason after deleting hello.cs I only get a file
called a.out when I compile which runs with no problems.

That's the expected behavior. Whatever hello.cs was, as you've seen
it wasn't needed.
What's with the name a.out? From what I read from another tutorial, I was
supposed to get a file called helloworld that I could run, and not this
a.out file.

The name of the executable depends on how you compile it. If you want
it to be named helloworld, gcc -o helloword your_c_file_name_here.c
would do it.

Before you post further, check out the following links. This group is
for standard C only - Linux things, such as the idiosyncrancies of
gcc, should be posted elsewhere (I suggest comp.unix.programmer).

http://www.csclub.uwaterloo.ca/u/dj3vande/clc/clc-welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html
 
M

m...

for gcc, it will name the output file as a.out
if u want to name it use the -o parameter
eg
# gcc -o helloworld helloworld.c

enjoy it!

jester.dev said:
I am learning c through an online tutorial currently. And I
am running Linux, but the tutorial does not deal specifically
with linux. I'm not sure if I am compiling correctly or not
because I get errors when running the compiled program when
using: gcc hellow_world.c which created a file called hello.cs.
Now for some reason after deleting hello.cs I only get a file
called a.out when I compile which runs with no problems.

What's with the name a.out? From what I read from another tutorial, I was
supposed to get a file called helloworld that I could run, and not this
a.out file.

Thanks for your time,
Michael


~ Let us linux ~
 
C

Charles Harrison Caudill

jester.dev said:
I am learning c through an online tutorial currently. And I
am running Linux, but the tutorial does not deal specifically

This is *completely* off topic, but we're all newbies at some point.

Read the man pages for gcc. Look at example code. Think of a little project
to do in c.

Learn to write Makefiles and autoconf scripts

For gcc, I reccomend the following cmd line options:

-ansi -pedantic -Wall -pipe -O2

As for learning c, there are two books for c u should buy, not borrow:

The C Programming Language (AKA K&R C) - Kerninghan and Ritchie
Efficient C Programming - Mark Allen Weiss

In general the weiss book is good for learning c, and k&r c is good for
reference.

best of luck!
 
J

jester.dev

Thanks everyone for the help. I'll be sure to read through
the FAQ, gcc manual and post in the appropriate group.
The tutorial I'm reading is based on the K&C book, but I
am still going to buy both.

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top