Learning c, need a little help with compiling.

Discussion in 'C Programming' started by jester.dev, Feb 16, 2004.

  1. jester.dev

    jester.dev Guest

    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
     
    jester.dev, Feb 16, 2004
    #1
    1. Advertising

  2. jester.dev <> spoke thus:

    > 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

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, Feb 16, 2004
    #2
    1. Advertising

  3. jester.dev

    m... Guest

    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" <> ???
    news:yaXXb.43512$uV3.84037@attbi_s51 ???...
    > 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 ~


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
     
    m..., Feb 16, 2004
    #3
  4. jester.dev <> wrote:
    > 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!

    --
    Harrison Caudill | .^ www.hypersphere.org
    Computer Science & Physics Double Major | | Me*Me=1
    Georgia Institute of Technology | v' I'm just a normal guy
     
    Charles Harrison Caudill, Feb 16, 2004
    #4
  5. jester.dev

    jester.dev Guest

    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
     
    jester.dev, Feb 16, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ThaDoctor
    Replies:
    3
    Views:
    385
    Alan Woodland
    Sep 28, 2007
  2. Andrew Savige
    Replies:
    10
    Views:
    450
    Hrvoje Niksic
    Jan 11, 2008
  3. zemir
    Replies:
    128
    Views:
    2,455
    Tim Rentsch
    May 7, 2012
  4. timr
    Replies:
    2
    Views:
    197
  5. Daniel
    Replies:
    1
    Views:
    214
    Bart van Ingen Schenau
    Jul 9, 2013
Loading...

Share This Page