Introduction: Create C++ Programs on the EEE PC

Picture of Create C++ Programs on the EEE PC

How To create, edit, and execute C++ programs on the ASUS EEE PC.

Please remember to leave constructive criticism only.

Step 1: Learn C++

Picture of Learn C++

If you already know C++ then you are welcome to skip this step....

If you don't then I suggest you go to one of these sites and learn C++ first.

The information won't be very useful if you can't practice on an IDE, so give the tutorials a while and see if this really looks like something you want to get into.

http://www.cplusplus.com/doc/tutorial/

http://www.learncpp.com/

http://www.3dbuzz.com

Use these or just go to Google and search for "C++ Tutorial"

Step 2: Open a Terminal

Picture of Open a Terminal

Easy Mode:

Easy mode is the interface that comes default with the EEE PC. The picture below with the orange background is an screenshot.

to get to a terminal just go to the desktop and press: 'Ctrl' + 'Alt' + 'T' (Press keys as though you were typing 'Ctrl + Alt +Del' )

Advanced Mode:

If you are in 'Advanced Mode' then I assume that you are knowledgeable enough to know what it looks like.

Advanced Mode: Go to Start Menu >> Applications >> System >> Console

Windows XP:

If you have windows XP then you can't get to a Linux terminal like Xandros can (not
without buying an special crossover)

If you want to create a C++ program on Windows I suggest you get one of the following:

Dev-C++ (A great free editor that works like just about any other Windows App)

Visual C++ express (A Microsoft App that takes forever to download and install)

Step 3: Get G++

Picture of Get G++

to compile the C++ from text into a program, I use G++

Obtain G++:

This step uses the terminal, use the previously mentioned method to get one up.

First you need to become a super user on your Console.

Type:

->su

Hit 'Enter'

-> nano /etc/apt/sources.list

now when this file opens you will need to add the following line

deb ftp://ftp.us.debian.org/debian stable main contrib non-free

(This is if you are in the United States)

Then type: 'Ctrl' + 'X'
Hit 'Enter'
Then: 'Y'

Next, hit 'Enter' to close what you were just working on and get back to your command line

Back on the command line
Type:

->apt-get update

after that finishes you need to enter:

-> apt-get install build-essential

Make sure to put a capital Y for yes when the console asks you if you want to continue.

this will install the GCC and G++ compilers needed to program in C or C++

Step 4: Make the Program!

Picture of Make the Program!

Go to the place where you want to have the program be in the console.

Type:

->kwrite ./your_program_here.cpp

your_program_here is where you put the name of your new program... (don't forget the .cpp)

this opens up a kwrite window

TYPE THAT CODE!

If you decided not to pay attention and did not learn C++, then I'll give you a simple "Hello World" program to test with.

Hello World Program:

(Start at the line under this one)

#include <iostream>

using namespace std;

main ( )
{

cout << "Hello World!";

cout << endl;

system("pause");

return 0;

}

(End at line above this one)

Hit save and exit kwrite.

back at the terminal type:

->g++ -g -o ./your_final_program_here ./your_original_program_here.cpp

Thanks to annex666 for catching that mistake

your_final_program_here is where you put the name of your final program (its wise to name it the same as your .cpp file)

Hit 'Enter'

Let g++ do it thing...(might take a while)

test it by typing:

->clear; ./your_final_program_here

If it works, close the terminal

If it doesn't, make sure that your terminal is in the same folder as your program.

Then try typing:

->./your_final_program_here

(make sure that you type the correct name of your program where 'your_final_program_here'
is and don't add the '.cpp' Executable programs in Linux don't have any extensions.)

The 'clear;' that went in front of your program just scrolls the terminal down so that it appears clean.

Step 5: Edit the Menu

This step is only if you have the advanced desktop.

If anyone knows how to put an Icon and a link to the program on easy mode please let me know.

Go to Start Menu >> Applications >> System >> Menu Editor

in the menu editor make a directory for your Programs.

Then under that new directory make a new item.

Call the Item whatever you want in the Name: box

If you want, pick an Icon for your program

Click on the folder icon by the Command: box and select your program.

Select the Radio button labeled "run In Terminal"

Hit Save.

To try out your program go to Start Menu >> your new directory >> your new program

There you have It!

Comments

jlafay (author)2009-04-04

There are a two other C++ IDE's for windows that work well and are worth mentioning. I started using CodeLite recently on my newest win machine and I love it. It uses the win GCC port, MinWG and can also compile using the vc++ compiler if you wish to do so. CodeLite can be found @ http://www.codelite.org

The other that I like and use on another machine is Code::Blocks. It too uses MinGW, VC++ and pretty much any other c++ compiler or compiler suite out there. You can find it at http://www.codeblocks.org

Both IDEs work well and aren't as resource heavy as vc++ express. Furthermore, they're both FOSS which is great :) Since you can use gcc or mingw it makes portability a little bit easier, depending on what software you're writing of course.

-jlafay

FreeTom (author)2009-03-10

hahaha sorry I just had to put this in but that's just too funny.
"Step 1: Learn C++" it might as well say "Step 1: Learn Japanese"
Anyway I've been teaching myself C++ for about 3 months now, it's pretty hard getting going but to add to your list of resources here, try http://www.3dbuzz.com and register as a free user, they have hours and hours of awesome videos on learning C++. The videos by themselves aren't going to teach you everything but gives a great knowledge base to work on with reading material. They have a testimonial section there and most users have said they tried with books first, failed, then after watching a few of their training videos it all became a lot more clear.

mattameo213 (author)FreeTom2009-03-11

Thanks for the suggestion. Yeah, Everyone who knows what C++ is thinks that I learned it to quickly. Its kinda strange, I had everything I ever needed to create a GUI app in under five months but I still can't get a grip with Quadratics in math class.

FreeTom (author)FreeTom2009-03-10

Oh one more thing, it doesn't make a whole lot of sense at this point to learn C++ without an IDE... this should've been step 3 really...

mattameo213 (author)FreeTom2009-03-11

Hmm... That make more sense than I care to admit. But many people I try to teach give up after a few lessons, and I'm told it happens to a lot of people, so I decided to let the user decide if they wanted to go through with this or not before setting them up with programs and have them crawling through the terminal, because if they don't find C++ to be their thing, its probable that the command prompt won't click either. Thank you for the post, I'll take it into consideration.

mattameo213 (author)2009-03-11

*Update* My EEE PC died this week. The stupid thing has been thrown off the roof of my 2 story house, dropped countless times, run over by a bike, thrown in a creek (that's an interesting one), hauled around in a 40 pound backpack, and used to coordinate a paintballing day (yes, it took 3 shots during the game) What finally broke it? A little bit of heat. I had dropped it at a friend's house and was running a bunch programs to make sure it still worked (not that there was any doubt) when it just turns off. As everything turns out, I had turned the fan off to save power at the friend's, forgot to turn it back on, and then it couldn't cool fast enough to keep up with the diagnostic programs. Luckily, the warranty hasn't run out yet. :)

mattameo213 (author)2008-12-26

I just put Win. XP on my eee. you know, to test it. Man its a lot more complicated to use, everything is ragtag trying to get all of the functionality.....

thepaul93 (author)2008-10-22

i want a eee so bad

mattameo213 (author)thepaul932008-10-23

Yeah, they're awesome.... I got a dev. version with a warrenty that lets me open it up and mess around without voiding it.

thepaul93 (author)mattameo2132008-10-24

sweet, how do you add more SSD drive space, do you just replace a card?

mattameo213 (author)thepaul932008-10-26

NO. The SSD is hard-soldered to the main board, it cant be easily removed or changed. you can however add a usb HD or a SD card.

thepaul93 (author)mattameo2132008-10-26

ok

peach_fart (author)2008-08-11

maybe ill try this when i get advanced desktop on my eee pc...

mattameo213 (author)peach_fart2008-08-11

Cool, The First thing I thought of when I saw the EEE on display was "ONLY $400" Closely followed by "I could use that for C++..."

Jestersage (author)2008-08-02

There's actually a better way: EE PC SDK. This will provide the best compatibility.

mattameo213 (author)Jestersage2008-08-03

Interesting... What does it do?? (What step would downloading this onto the EEE make more simple??)

Jestersage (author)mattameo2132008-08-03
The EEE PC SDK comes with a complete OS (non live) and all the tools It need:
  • Xandros Desktop Open Circulation Version 4.5
  • QT
  • Eclipse
  • QT plugin for Eclipse
  • Debian packaging wizard developed by Xandros
With these, you can make GUI-based EEE PC application easily. G++ is still do able, but will be more complicated... and you still need the QT library, which is the library employed by the default EEE-PC-Linux's Window manager

Detail instruction here

Also, don't forget that Some EEE PC comes with Windows XP (and in that case, Visual C++ express could be better), and there was rumors that future EEE PC will instead run Ubuntu Mobile Edition, which will use GTK libraries instead.
mattameo213 (author)Jestersage2008-08-03

Ok, Thanks

I just got everything how I wanted it so I won't try this. It looks like something that would me more useful to know If you just got you EEE.

PS: It sounds like a great instructible......

annex666 (author)2008-08-03

The command line in the third image is incorrect - the name of the output should be placed directly after the -o flag, e.g: g++ -g -o my_binary source_1.cpp source_2.cpp

mattameo213 (author)annex6662008-08-03

Thanks man, I'll edit that in now.

Coffee bean (author)2008-08-02

so does the eee pc run a linux based OS?

mattameo213 (author)Coffee bean2008-08-03

Yeah, what threecheersfornick said. It runs a custom Xandros and anything above the 2GB surf can handle win XP and Other Linux Distros.

Yes. Xandros, but tweaked a bit, I think. They can also run ubuntu, windows XP, or whatever else you want.

About This Instructable

6,013views

15favorites

License:

More by mattameo213:Tunes To Go!Create C++ Programs on the EEE PCCool Trick With iPods!
Add instructable to: