Find the answer to your Linux question:
Results 1 to 9 of 9
Hi guys, i'm new in programming, but i want to give it a try and learn about programming. i'm planning to learn about C++ on linux. what kind of application ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! braintoxin's Avatar
    Join Date
    Apr 2005
    Posts
    19

    Newbie Questions about programming


    Hi guys, i'm new in programming, but i want to give it a try and learn about programming. i'm planning to learn about C++ on linux. what kind of application should i use? i'm using suse 10.1 and where can i find about C++ and all of the resource.

    thanks

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Hi !!!

    just write C++ program in editor CLI... vi or emac.. GUI ...gedit or kate

    compile and run

    $ c++ <file.h>
    you will get a file a.out... run it
    $ ./a.out

    for C++ tutorials check these links.......

    http://www.zeuscmd.com/tutorials/cplusplus/index.php
    http://www.cplusplus.com/doc/tutorial/
    http://en.wikibooks.org/wiki/C++
    http://cplus.about.com/od/beginnerct...blcplustut.htm
    http://www.bloodshed.net/dev/doc/index.html


    ... casper ...
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    As far as C++ IDEs go, I've always been most successful just using text editors: gedit (GNOME), kate (KDE), or Vi or Emacs (commandline). If you're looking for a full-fledged IDE, KDE has KDevelop, and there's also Anjuta. Eclipse (a Java IDE) also has a C++ plugin.

    There are a ton of free online resources for learning C++: if you're like me and prefer a real book, I'd recommend "C++: How to Program" from Deitel and Deitel. I found great success with it. I also hear good things about "C++ in 21 Days" or whatever it's called.

    Finally, regarding compilation of C++ files (if you use a regular text editor), if my code is in hello.cpp, and I want the program to be called "hello", I would run:
    Code:
    g++ -Wall -o hello hello.cpp
    What is this?
    g++ - GNU C++ Compiler
    -Wall - Enable all warnings
    -o hello - Call the outputted binary "hello"


    Best of luck!

  4. #4
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    Cabhan is right on the money. I'd just like to add a reference to a nice little GUI code editor called SciTE, which features syntax highlighting, automatic indentation, and a button that will run g++ on your source and show you the output of the executed program. The two drawbacks are that program execution is non-interactive (so if your program asks you to type something in, you won't get a chance), and you'll probably have to fiddle with a settings file to get it to run your compiled code the way it's supposed to. Both are easy to work around, though, and this was my favorite editor from cover to cover of Sam's Teach Yourself C++ in 21 Days.
    Stand up and be counted as a Linux user!

  5. #5
    Just Joined!
    Join Date
    Sep 2006
    Posts
    6
    this is my problem:




    it seems like I'm missing a compiler, but there doesn't seem to be any compiler package to add from the add/remove package menus. what am i missing here?

  6. #6
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    That's very strange. Are your repositories set up correctly? The package should be called 'gcc'.

  7. #7
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,283
    Hi.

    I'll take a chance and guess that the background of your screenshot looks like ubuntu brown. If you're using that, you will need to do something like:
    Code:
    sudo apt-get install build-essential
    and, assuming that your repositories are set up as Cabhan mentioned, that will install packages necessary for making, compiling, and linking, after which you can start programming with gcc. I needed to do that when I first installed ubuntu.

    If it's not ubuntu, then let us know which distribution you are using so we can answer your questions more accurately -- you can put the distribution name in your Options section of User CP and it will show up on each post.

    Best wishes ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  8. #8
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Hi !!

    in Ubuntu, 'gcc' is not installed by default.......
    use apt-get or synaptic to install 'gcc'



    .... casper ....
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  9. #9
    Just Joined!
    Join Date
    Sep 2006
    Posts
    6
    thanks so much, you guys! my terminal is busily downloading packages

Posting Permissions

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