Archive for May 23, 2008

Xubuntu Testbed

Right now I’m posting this from my old laptop that I’m going use as a testbed for my programing stuff.  I’m just bored right now………………….and had nothing better to do :P

C++ Binaries In Linux: A How-To

I have been trying to learn C++ for quite a while now. It has finally started to click with me. I guess I just have to read over the SAME things over and over and over again until I finally understand. I figured out how to use g++, and how to make binaries execute system-wide in Linux.

Now I know these are sort of n00bish discoveries, but to me they really helped in the understanding of the C++ language, and the way Linux works.

I found some resources online for learning C++, and will include them at the end of the post.

Ok, now on to the tutorial:

  1. Write your C++ program.(links at the end of the post will show you how)
  2. compile it by running
  3. g++ /path/of/source/file -o /where/you/want/binary/to/end/up

  4. Step 2 generates a binary at /where/you/want/binary/to/end/up. Of course you change this path to wherever you want your binary to go.
  5. Now that you have your binary generated, name it something meaningful and run this command:
    sudo cp /where/you/want/binary/to/end/up /bin
  6. Step 4 copies your binary to where Linux stores all it’s binaries: /bin

Now you have a binary that you can call from the command line!
call it like this:
programname
It’s that simple, all you have to do is type in the program’s name and it will run. Cool, huh?

Learning C++ Resources:
isocotton.com
cplusplus.com
C++ wikibook