AD (728x60)

Senin, 17 Februari 2014

Cara Compile dan Run C++ di Linux

Share & Comment
Bismillah
Cara compile dan run C++ di Linux ternyata cukup mudah. Pertama, install g++
sudo apt-get install g++
Kedua, ketik koding C++ dengan menggunakan teks editor, kodingnya misalkan seperti ini:

// program pertama ane di C++

#include <iostream>
using namespace std;
int main ()
{
cout << "Alhamdulillah, bisa compile!" << endl;
return 0;
}

simpan koding dengan nama (misalnya) test.cpp | cpp merupakan singkatan dari C plus plus.
Ketiga, buka terminal atau tekan [CTRL] + [ALT] + [T], masuk ke direktori dimana file koding C++ tadi disimpan, (misalnya disimpan di Documents)
$ cd Documents/
buat output dari file test.cpp
$ g++ test.cpp -o test
eksekusi file "test"
$ ./test
Screenshot-nya kurang lebih seperti ini


Tags:

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 komentar:

Posting Komentar

 

Popular Content

Recent Posts

Why to Choose RedHood?

Copyright © Demo : Red Hood | Designed by Templateism.com