Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24
hello everyone i have done c++ programming in windows but now i need to perform c++ programming on Linux. so can u please tell me how can i get started ...
  1. #1
    Linux User bilal_jan's Avatar
    Join Date
    Mar 2008
    Location
    Pakistan
    Posts
    281

    c++ in linux

    hello everyone
    i have done c++ programming in windows but now i need to perform c++ programming on Linux.
    so can u please tell me how can i get started with this means wt compiler should i use and other stuff needed to compile c++ code
    thanks

  2. #2
    Linux Engineer khafa's Avatar
    Join Date
    Apr 2008
    Location
    Tokyo, Japan
    Posts
    858
    hi,



    you can use g++ of the gcc package. below is the gcc page
    gcc
    Linux and me it's a love story

  3. #3
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    gcc is available in Installation Media. Open Yast and search for gcc. Select and install it.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  4. #4
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    If you need an IDE, try KDevelop if you use KDE and Anjuta or Geany if you use GNOME.

  5. #5
    Linux User bilal_jan's Avatar
    Join Date
    Mar 2008
    Location
    Pakistan
    Posts
    281
    ok thanks for reply
    but how can i know that my system has compiler for c++.
    i have opensuse10.3 !!!
    do this contain c++ compiler or i have to download it from internet.
    plz tell me how to compile a very basic program with c++ compiler on linux,this will help me alot!!!
    thanks!!

  6. #6
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    You can check by doing
    Code:
    $rpm -qa | grep -i gcc
    If gcc-c++ is not listed in the results, then you do not have the compiler installed. The easiest way to install it would be to go to YAST -> Software -> Software repositories, enable the main oss repository and then run YAST -> Software -> Software Management, search for gcc and then choose the packages you wish to install. If you have the DVD you can skip the first step and go straight to searching for gcc in YAST -> Software -> Software Management and installing it.

  7. #7
    Linux Guru gogalthorp's Avatar
    Join Date
    Oct 2006
    Location
    West (by God) Virginia
    Posts
    3,105
    Look in Yast-Software-Software Management for the gcc compiler.

    If you installed from a DVD the compiler should be on it. If not you can install via the opensuse repository. It is not installed by default.

    Once installed you at a konsole prompt type

    info gcc

    for all the options.

    You must crawl before you can run

  8. #8
    Linux User bilal_jan's Avatar
    Join Date
    Mar 2008
    Location
    Pakistan
    Posts
    281
    thanks daark.child and gogalthorp for reply i installed gcc following ur instructions.
    but i have a problem in getting started with gcc.
    I created a file named test.c on the desktop
    and pasted the following code in the file
    Code:
    #include<iostream.h>
    #include<conio.h>
    
    void main()
    {
    cout<<"welcome to the world of Linux";
    getch();
    }
    when I try to compile this code using

    ahmed@linux-pxgb:~/Desktop> gcc test.c

    I am getting the following errors
    Code:
    test.c:1:21: error: iostream.h: No such file or directory
    test.c:2:18: error: conio.h: No such file or directory
    test.c: In function ‘main’:
    test.c:5: error: ‘cout’ undeclared (first use in this function)
    test.c:5: error: (Each undeclared identifier is reported only once
    test.c:5: error: for each function it appears in.)
    test.c:4: warning: return type of ‘main’ is not ‘int’
    test.c:7:2: warning: no newline at end of file
    tell me how i get the output!!!

  9. #9
    Linux Guru gogalthorp's Avatar
    Join Date
    Oct 2006
    Location
    West (by God) Virginia
    Posts
    3,105
    Looks like you need a path to the location of the *.h files. The compiler can't find them. there are three things you can do

    1) add the full path in your #include
    2) copy the files to your current work directory
    3) set $PATH to point to the *.h location.

  10. #10
    Linux User bilal_jan's Avatar
    Join Date
    Mar 2008
    Location
    Pakistan
    Posts
    281
    thanks gogalthrop for reply.
    well i am not getting ur three points.
    Code:
    add the full path in your #include
    where can i find the include files and how can i get its address.
    Code:
    copy the files to your current work directory
    working directory means wh directory???
    also please tell me about ur last point

Page 1 of 3 1 2 3 LastLast

Posting Permissions

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