compile c/c++ on ubuntu

first install package name build-essential

$ sudo apt-get install build-essential

for compile c use this command

$ gcc filename.c

for compile c++ use this command

$ g++ filename.cpp

after compile will get file name a.out

if want to change file name add this parameter when compile

$ gcc filename.c -o output_filename or $ g++ filename.cpp -o output_filename

for run the program use this command

$ ./filename ex. $./a.out


One thought on “compile c/c++ on ubuntu


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out /  เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out /  เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out /  เปลี่ยนแปลง )


Connecting to %s