Thread: First program questions

  1. #1
    Registered User
    Join Date
    Jun 2010
    Location
    127.0.0.1
    Posts
    9

    First program questions

    I am now officially started to learn C. I eventually want to be able to code basic robots. I have also gotten a copy of "The C Programming Language" I have heard it is the Bible of C so I figured I should have one.

    I have coded some C++, javascript, html, and css so coding is not new to me but I have heard C is no easy language to tackle.

    I am running both ubuntu linux and windows vista but I imagine that i will be doing most of my C programming on ubuntu because that is what it is designed for.



    So I cracked open the Bible and in the first two pages I am writing the famous 'Hello, world!" program. I like coding in the first two pages. But I have run into a snag; I am using Eclipse, heard it was good but I am not sure yet (if you have other editor suggestion by all means suggest them), and I wrote the program as instructed by the book. Saved it as 'hello.c' and compiled it in the terminal with the 'cc' command. It gave me an 'a.out' file which I tried to run by typing 'a.out' in the terminal. The output was 'a.out command not found'.

    I double and triple checking my spelling and syntax but it was correct. I am not sure what I am doing wrong and would like to continue working on this as soon as i get over this little hiccup.

    Thanks in advance for the help.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    ./a.out


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jun 2010
    Location
    127.0.0.1
    Posts
    9
    sweet man thanks a ton

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by spottedzebra View Post
    I am running both ubuntu linux and windows vista but I imagine that i will be doing most of my C programming on ubuntu because that is what it is designed for.
    Designed for what???

    But I have run into a snag; I am using Eclipse, heard it was good but I am not sure yet (if you have other editor suggestion by all means suggest them).
    There are a couple of IDEs. My favorite for Windows is Visual Studio.
    Here is a short list: SourceForge.net: Integrated Development Environment - cpwiki
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    i will be doing most of my C programming on ubuntu because that is what it is designed for.
    I assume you meant most of the tools (compiler that supports latest standard,debugger,memory checker,code generator such as yacc && lex) are freely available.
    You might want to read An Introduction to GCC.

  6. #6
    Registered User
    Join Date
    Jun 2010
    Location
    127.0.0.1
    Posts
    9
    yes, i mean it comes with gcc pre-installed you can get much closer than that.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    o_O
    The OS isn't "designed" for programming just because it includes a compiler.
    Download an IDE for any platform and you're good to do. You can't get much closer than that. You'll still need a couple of tools separately from the compiler to do your programming, so...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by spottedzebra View Post
    I have coded some C++, javascript, html, and css so coding is not new to me but I have heard C is no easy language to tackle.
    If you're coding in a bunch of languages like that, it might be better not to use an IDE especially if it does not support all of them. Otherwise you have to get used to separate tools for everything, which is really a waste of time.

    My advice is to just use the command line on linux for gcc and gdb (there are several stand-alone GUI versions of gdb too, such as ddd), and then use a good text editor that supports syntax highlighting for any language (they do exist). My own preference is gvim: although it has a steep initial learning curve, it's well worth it, it has most (and more) of the features of a C/C++ IDE (except the built in debugging and compiling), it's programmable, and you can use it for anything (not just C/C++ and Java, etc).

    http://www.vim.org/

    The command line on linux is the place to be. As you observe, it was intended to be a development environment, unlike windows. Compiling is dead simple and straightforward. Everything else is there, since GUI's are mostly just built as front-ends to to console commands. And you can get a lot more done without having to open fifteen different GUI's. If you want to program on linux, I'd say using the command line (and the standard apps it provides) as much as possible is a must. Also, if you use gvim, it's the GUI version of vim, which can be fired up instantly in a terminal to do something quickly, so you don't have to bother finding the file in a browser and sending it to the GUI editor.*

    Just pick a nice low-contrast background image for your X terminal

    * if you compile gvim with "server" built in, you can send files to it straight from the command line via vim --remote filename, but distro packages are not built this way
    Last edited by MK27; 06-18-2010 at 09:43 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. simple chat program questions
    By surefire in forum C Programming
    Replies: 5
    Last Post: 11-05-2009, 08:16 PM
  2. Replies: 2
    Last Post: 09-16-2009, 06:00 AM
  3. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  4. A few program questions regarding while loops
    By tigerfan88 in forum C++ Programming
    Replies: 3
    Last Post: 02-02-2008, 05:41 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM