Find the answer to your Linux question:
Results 1 to 10 of 10
Ok, I am completely new to C++, but not linux Im using Red Hat 7.3, and have been for a little while now I also studies Pascal, and Visual Basic ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2002
    Location
    Norway
    Posts
    17

    C++ Newbie


    Ok, I am completely new to C++, but not linux
    Im using Red Hat 7.3, and have been for a little while now
    I also studies Pascal, and Visual Basic in college, so have the jist of programming, loops, etc..

    Im wanting to learn C++
    Heres my questions....

    Where can I get beginner info/tutorials to start teaching me basics?
    What tools do i need to be able to write and compile a program?

    Any help would be appreciated

    Thanks

  2. #2
    Linux User
    Join Date
    Nov 2002
    Posts
    420

    C++

    Paul,

    Glad to here you a learning C++. I think that every programmer should learn it. I can't help you with beginner info/tutorials, I would rather advise you to purchase some good books. Also, if you are not familiar with C, I would advise you to become familiar with C first.

    I recommend reading: The C Programming Language by Brian Kernighan and Dennis Ritchie. This is the definitive reference for the C language. These guys invented it so they know what they are talking about. Depending on your level of computer knowledge you may have a difficult time reading it, but if you expect to master the language you better have a copy of this book.

    Also, The C++ Programming Language by Bjarne Stroustrup is a must. Stroustrup is the creator of C++ and he knows what he is talking about. Again, it is a difficult read depending on your level of knowledge but a must have.

    If you need any other book suggestions, I would say, pay a visit to amazon.com and read the book reviews. And maybe some other sites as well that list book reviews.

    Tools:

    Make sure that you have all or most of the development packages installed for RedHat. This will make it easier in the long run.

    You will need a compiler like gcc or something else.
    You will need make once your programs start getting complex.
    You don't absolutely need make, but it makes programming easier.
    Also, eventually you are going to want to debug your programs with something other than outputing to the terminal, which is an adequate way to debug for small programs, but not for complex ones.
    Once your programming becomes more complex you will need a debugging tool such as gdb.
    All these tools should be installed if you install all the development rpms for RedHat.

    Once you are sure that you have all these tools installed on you linux box, make sure that you read the man pages. For example, at the command line in a terminal type: man make
    This will bring up the manual for the make tool.
    Get the idea.
    Also, I'm not sure if there are any Howto's on programming in C or on Linux, but if there are some I'd start reading these as well. They should be installed on your linux system, if not try searching at google.com.

    Good luck and happy hacking!

    Have fun!

  3. #3
    Just Joined!
    Join Date
    Oct 2002
    Location
    Norway
    Posts
    17
    Update

    I downloaded an ebook, C++ for beginners

    I figured out that I can use any text editor, so then started using pico for an example program
    i made my example program, 'hello.C' which is as follows:

    #include <iostream.h>

    int main()
    {
    cout << "Hello World!\n";
    return 0;
    }
    ok, now how to compile?
    I go to the gcc webpage, http://gcc.gnu.org and read some stuff about compiling and linking

    I compile my program with:
    'g++ hello.C' in xterm, it makes a 'a.out' file

    Then I can execute it with ./a.out
    It prints 'Hello World' to the screen, bingo

    Questions:
    Is there a way to make 'a.out' named something else?

    Are there any better text editors for linux that are better than pico? say, that show line numbers without effecting the code? plus search features and other usefull little things that i can use

    What rpm packages would I need to install in order to use gcc, all its libraries??
    Im using Red Hat 7.3

    Thanks!

  4. $spacer_open
    $spacer_close
  5. #4
    Linux User
    Join Date
    Jul 2002
    Location
    Daytona Beach, FL
    Posts
    487
    yeah - man gcc will tell you you can pass it a -o option to name the file something else
    majorwoo

    Quiet brain, or I\'ll stab you with a Q-tip.

  6. #5
    Just Joined!
    Join Date
    Nov 2002
    Location
    USA
    Posts
    99
    Regarding text editors, I use vi or vim.
    I've never used emacs, been quite happy with vi, but I've heard it can do some things better, especially if you are programming in LISP.

    Don't ask me to explain vi/vim, that's a whole new ball game. It takes quite a while to master it.
    If you manage to master the basic commands of vi/vim,
    the command to show line numbers is:
    set nu

  7. #6
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    YEAH! Emacs! Best editor I've ever used in my life! It does a month or so to get used to the new key bindings when you've spent three quarters of your total life span using DOS editors, but it is SO worth it! Emacs might not be the best-looking editor in the world, but there is no doubt in my mind that it's the best. If you're in doubt, there's even a built in tutorial: First press Ctrl-'h' and then 't' to access it.

  8. #7
    Linux User
    Join Date
    Jul 2002
    Location
    Daytona Beach, FL
    Posts
    487
    blah - pico all the way!
    majorwoo

    Quiet brain, or I\'ll stab you with a Q-tip.

  9. #8
    Just Joined!
    Join Date
    Feb 2003
    Location
    Wah Cantt, Pakistan.
    Posts
    8
    gedit is the easiest and is included in RH 7.3 which i am using too.gurus talk about vi,emacs etc but for a newbie like me gedit is best to take a start

  10. #9
    Linux User
    Join Date
    Feb 2003
    Location
    Norway, Asker
    Posts
    267
    there is a lot of programming IDE wich you should pay attention to. examples im talking about is ex. "anjunita" or "code forge". They both give syntax highlightning, which is a good thing. Also, activestate's komodo (yeah, i know, perl etc) gives you those red lines under the text which is wrong and won't compile.

    But if you don't like programming IDE's, I can advice you to try out gvim. exellent editor.

  11. #10
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I can just say that nothing matches emacs, and nothing probably ever will. Emacs forever! =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •