Skip to main content

Posts

Showing posts from December, 2012

Mendevelop C++ Di Lingkungan Linux

Seperti diketahui bahwa Linux itu dibuat dengan menggunakan bahasa C. Dan compiler bawaannya adalah GCC (Gnu Compiler Collection). Kelebihan Linux adalah secara default sudah terdapat C dan C++ compilernya. Jadi anda tinggal menggunakannya. Untuk mengetes versi GCC yang terdapat pada sistem Linux Anda. Gunakan perintah berikut: $ gcc –version gcc (GCC) 4.7.1 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Bila di console muncul seperti itu, maka compiler GCC-nya sudah siap digunakan. Untuk mencoba melakukan kompilasi, tulis contoh program C++ sederhana berikut: #include using namespace std; int main() { cout << “Hello World!” << endl; return 0; } Simpan sebagai hello.cpp. Kemudian coba Anda compile source code c++ tersebut dengan menggunakan perintah berikut: $ g++ hello.cpp -o hello $ ls hello.cpp hello* Jalankan program-n