Introduction: 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++

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

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++

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!

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!