Post by sadbutrue on Oct 24, 2005 12:05:48 GMT 7
Getting a C++ Compiler
For Windows users, especially beginners, I suggest getting an integrated development environment (IDE) for doing your work. You will get syntax hightlighting, debugging and compiling all in one package. For these tutorials I suggest you use Bloodshed's Dev-C++. It is a free IDE that has a compiler based on gcc. You can get it here:
www.bloodshed.net/devcpp.html
I've just tried the lastest beta on windows and it works. If you want to run a different compiler or IDE that is fine, but it would be easier if you all stick to one type of environment for windows. I've also worked in Microsoft's Visual Studios, so if you run it thats ok. If your use borland or any other compiler your own your own.
-------------
For Linux users or Mac users, GCC should suffice and shouldalready be on your computer. If you want an IDE I suggest Kdevelop. Linux users can get it here:
www.kdevelop.org/
It is a little bit more complicated for mac users. You'll need to follow this:
ranger.befunk.com/phpwiki/
--------------
Compiling Your First Program
Dev-C++ Users:
1. Open up the Dev-C++
2. On the top menu go to File->New->Project
3. Click on Console Application
4. Under the Name call it whatever you want
5. Save the Project whereever you want
At this point it will create the project and a basic c++ file will show up in the main window. Before the line that says: "system("Pause")", type the following:
cout << "Hello World\n";
Now click on the floppy at the top to save the file. Then on the top menu go to execute->compile & run. If everything was successfull a command prompt window should popup and display the words "Hello World" without quotes.
----------------
GCC users:
Open up your favoriate text editor and type the following:
Code:
#include<iostream>
using namespace std;
int main( int argc , char **argv ) {
cout << "Hello World\n";
return 0;
}
Save the file as program1.cpp and open the command prompt. Locate your program and type:
g++ program1.cpp
If that doesn't work try CC program1.cpp or gcc program1.cpp. Depending on how your system is setup the compiler will be called differently. To run the program type:
./a.out
You should see "Hello World" displayed
---------------
For Kdevelop Users:
1. On the top menu go to Project->New Project->C++->Simple Hello World Program
2. Call the application whatever name you want and give an author name
3. Hit Next 3 times then Finish
4. On the top menu go to Build->Execute Program
5. If a window comes up say yes.
6. When it is done compiling a window should pop-up saying "Hello World!"
til next.......
IM SAD
For Windows users, especially beginners, I suggest getting an integrated development environment (IDE) for doing your work. You will get syntax hightlighting, debugging and compiling all in one package. For these tutorials I suggest you use Bloodshed's Dev-C++. It is a free IDE that has a compiler based on gcc. You can get it here:
www.bloodshed.net/devcpp.html
I've just tried the lastest beta on windows and it works. If you want to run a different compiler or IDE that is fine, but it would be easier if you all stick to one type of environment for windows. I've also worked in Microsoft's Visual Studios, so if you run it thats ok. If your use borland or any other compiler your own your own.
-------------
For Linux users or Mac users, GCC should suffice and shouldalready be on your computer. If you want an IDE I suggest Kdevelop. Linux users can get it here:
www.kdevelop.org/
It is a little bit more complicated for mac users. You'll need to follow this:
ranger.befunk.com/phpwiki/
--------------
Compiling Your First Program
Dev-C++ Users:
1. Open up the Dev-C++
2. On the top menu go to File->New->Project
3. Click on Console Application
4. Under the Name call it whatever you want
5. Save the Project whereever you want
At this point it will create the project and a basic c++ file will show up in the main window. Before the line that says: "system("Pause")", type the following:
cout << "Hello World\n";
Now click on the floppy at the top to save the file. Then on the top menu go to execute->compile & run. If everything was successfull a command prompt window should popup and display the words "Hello World" without quotes.
----------------
GCC users:
Open up your favoriate text editor and type the following:
Code:
#include<iostream>
using namespace std;
int main( int argc , char **argv ) {
cout << "Hello World\n";
return 0;
}
Save the file as program1.cpp and open the command prompt. Locate your program and type:
g++ program1.cpp
If that doesn't work try CC program1.cpp or gcc program1.cpp. Depending on how your system is setup the compiler will be called differently. To run the program type:
./a.out
You should see "Hello World" displayed
---------------
For Kdevelop Users:
1. On the top menu go to Project->New Project->C++->Simple Hello World Program
2. Call the application whatever name you want and give an author name
3. Hit Next 3 times then Finish
4. On the top menu go to Build->Execute Program
5. If a window comes up say yes.
6. When it is done compiling a window should pop-up saying "Hello World!"
til next.......
IM SAD