C++ in Linux

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ThePatriot

    #1

    C++ in Linux

    Well, i finally got redhat working on this old box i had, and read the man pages on gcc and g++, i tried to get a very very simple c++ scipt to work but im having some troubles. The script was basic

    #include <iostream.h>

    int main()
    {
    cout<<"Hello" im leaving out endl; cuz it wont work on forums
    return 0;
    }



    ok, so i type it up and save it as hello.cc, then in the console i type in g++ -c hello.cc and it claims it works, but i cant find out where the output of the file is. Any suggestions?
  • SlipknotX556
    Registered User
    • Nov 2001
    • 5054

    #2
    Yhea you got it working on my old box.

    Tiger Stripe Barrel Condoms F/S
    Warped Kustoms - Custom Headgear and Apparel
    Click Here For My AO Feedback
    Click Here For My PBN Feedback

    Comment

    • alkafluence
      Slave to the Traffic Light
      • Jun 2002
      • 543

      #3
      Try the -o flag and then specify the file name you want it to come out as. If you don't specify the name or the -o flag the output file will be "a.out."

      (an example for a c compilation)
      gcc -o fileiwant sourcefile.c

      This will produce an executable file called "fileiwant."


      I'm not under the alkafluence of inkahol that some thinkle peep I am. It's just the drunker I sit here the longer I get...

      Comment

      • 314159
        Registered User
        • Nov 2001
        • 555

        #4
        do u mean

        #include<iostream.h>

        int main()
        {
        cout<<"Hello, im leaving, out"<<endl; //cuz it wont work on forums
        return 0;
        }
        As society and the problems that face it become more and more complex and machines become more and more intelligent, people will let machines make more of their decisions for them, simply because machine-made decisions will bring better results than man-made ones. Eventually a stage may be reached at which the decisions necessary to keep the system running will be so complex that human beings will be incapable of making them intelligently. At that stage the machines will be in effective control. People won't be able to just turn the machines off, because they will be so dependent on them that turning them off would amount to suicide

        sometimes I just freaking hate people. which means the next day I will love them for the sake of balance, but right now I will just concentrate on the hating. Hate hate hate. Blaaaarg! ;)

        turborev - with ai like this, if it controlled any more than a paddle, it would kill you and everyone you care about. ;)

        Comment

        • 314159
          Registered User
          • Nov 2001
          • 555

          #5
          hehe, i see that this board has a way of "editing" your text

          hehehehe
          As society and the problems that face it become more and more complex and machines become more and more intelligent, people will let machines make more of their decisions for them, simply because machine-made decisions will bring better results than man-made ones. Eventually a stage may be reached at which the decisions necessary to keep the system running will be so complex that human beings will be incapable of making them intelligently. At that stage the machines will be in effective control. People won't be able to just turn the machines off, because they will be so dependent on them that turning them off would amount to suicide

          sometimes I just freaking hate people. which means the next day I will love them for the sake of balance, but right now I will just concentrate on the hating. Hate hate hate. Blaaaarg! ;)

          turborev - with ai like this, if it controlled any more than a paddle, it would kill you and everyone you care about. ;)

          Comment

          • ThePatriot

            #6
            Yea it does, i tried to put < < endl; in but it kept editing it so i gave up.

            Comment

            • lopxtc
              Unix Geek
              • Oct 2001
              • 2706

              #7
              No you use the -o flag with the g++ command .. that specifies the name and location of the out file. Without that flag it creates a binary named a.out


              Aaron
              Team Managed Aggression, Missouri Paintball

              Pround owner of a 2003 Shocker, and AO.org user ... an almost unheard of combo.

              "Love, Peace, and Shonen Knife!"
              AOLIM - lopxtc

              Comment

              • 314159
                Registered User
                • Nov 2001
                • 555

                #8
                is your rl name Aaron?..... if so, then there are too many of us out there O_o
                As society and the problems that face it become more and more complex and machines become more and more intelligent, people will let machines make more of their decisions for them, simply because machine-made decisions will bring better results than man-made ones. Eventually a stage may be reached at which the decisions necessary to keep the system running will be so complex that human beings will be incapable of making them intelligently. At that stage the machines will be in effective control. People won't be able to just turn the machines off, because they will be so dependent on them that turning them off would amount to suicide

                sometimes I just freaking hate people. which means the next day I will love them for the sake of balance, but right now I will just concentrate on the hating. Hate hate hate. Blaaaarg! ;)

                turborev - with ai like this, if it controlled any more than a paddle, it would kill you and everyone you care about. ;)

                Comment

                • alkafluence
                  Slave to the Traffic Light
                  • Jun 2002
                  • 543

                  #9
                  Originally posted by lopxtc
                  No you use the -o flag with the g++ command .. that specifies the name and location of the out file. Without that flag it creates a binary named a.out


                  Aaron
                  That's what I said...


                  If you don't specify the name or the -o flag the output file will be "a.out."
                  In other words if you don't put it there ----> it gives you "a.out"


                  I'm not under the alkafluence of inkahol that some thinkle peep I am. It's just the drunker I sit here the longer I get...

                  Comment

                  Working...