Results 1 to 5 of 5

Thread: Compiling a C++ Program

  1. #1
    Join Date
    Aug 2013
    Beans
    2

    Post Compiling a C++ Program

    Hi, everyone! Sorry if this post is in the wrong subforum. I'm trying to compile the following C++ program, called hello.cc, from the command-line:

    Code:
    #include <iostream>
    
    int main()
    {
        using namespace std;
        
        cout << "Hello world!";
        
        return 0;
    }
    I'm using the command CC hello.cc, but the computer tells me the command was not found. I'm trying to use this program because I want to use the Solaris C++ compiler, and, from what I've researched, this is the one, and the cc program is the C compiler, am I correct? If I am, how do I properly install CC? I don't want to use GCC. Thanks in advance!

  2. #2
    Join Date
    Sep 2008
    Location
    Chicago
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Compiling a C++ Program

    Quote Originally Posted by fernando6 View Post
    I'm trying to use this program because I want to use the Solaris C++ compiler, and, from what I've researched, this is the one, and the cc program is the C compiler, am I correct?
    The one for what? Most of us use GCC. Can't help you with others, especially commercial stuff. Also, this thread belongs elsewhere. Good luck to you!
    Last edited by whitesmith; October 4th, 2013 at 01:49 AM.
    In working with *nix...There be dragons. Newcomers: I recommend reading Linux is Not Windows (http://linux.oneandoneis2.org/LNW.htm) and The Linux Command Line (http://www.linuxcommand.org/tlcl.php) before beginning your quest for a better OS.

  3. #3
    Join Date
    Jan 2006
    Location
    Not heaven... Iowa
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Compiling a C++ Program

    Moved to Programming Talk.
    Linux User #415691 Ubuntu User #8629
    Iowa Team (LoCo): [Wiki] [Launchpad]
    IRC channel: #ubuntu-us-ia on irc.freenode.net

  4. #4
    Join Date
    May 2007
    Location
    Leeds, UK
    Beans
    1,664
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Compiling a C++ Program

    Don't worry about the compiler, worry about the language. If you are using Ubuntu, or any other Linux distribution, just use the default GNU compiler:

    Code:
    g++ hello.cc -o hello
    Please create new threads for new questions.
    Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].

  5. #5
    Join Date
    Sep 2011
    Location
    South Africa
    Beans
    165
    Distro
    Xubuntu 12.10 Quantal Quetzal

    Re: Compiling a C++ Program

    I agree with r-senior, stick with g++ Here's a simple tutorial to get started http://www.vietspring.org/cpp_linux/gpp.html . I'm sure you can find other tutorials through Google.

Bookmarks

Posting Permissions

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