Compile my helloworld cpp program on Ubuntu linux
2011-03-07 11:01
447 查看
Usually, I work on windows platform, use Visual Studio and click the build button->compile and link done! Mostly, I modify the compile&link options, it's fast and stupid. My job is SDET, both the developer and tester, I want to learn more develop skill to support my work, these days, corp want to do something on Android platform, so I need some linux program experience.
First, I install a VM ware and ubuntu as a virtual machine.
And use sudo apt-get install g++-4.4 command in terminal.
Command: g++
Command: sudo apt-get install g++
Command: sudo apt-get install pentium-builder
After these happy installings, I use gedit edit my helloworld.cpp
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World!"<<endl;
return 0;
}
And use command "g++ HelloWorld.cpp -o HelloWorld" in terminal.
Then it's the greatest time! command: .\HelloWorld
The program print Hello World! in terminal command line.
It's OK! I'm becoming a linux cpp programmer~!
Then I want to try makefile:
New a file named "makefile", and edit:
hello: HelloWorld.cpp
g++ HelloWorld.cpp -o hello
"hello" here means a target, if it's old or not exist, it will be made. The second line means the compile and link command.
Ok, I can use makefile to compile my cpp file now!
Good luck!
First, I install a VM ware and ubuntu as a virtual machine.
And use sudo apt-get install g++-4.4 command in terminal.
Command: g++
Command: sudo apt-get install g++
Command: sudo apt-get install pentium-builder
After these happy installings, I use gedit edit my helloworld.cpp
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World!"<<endl;
return 0;
}
And use command "g++ HelloWorld.cpp -o HelloWorld" in terminal.
Then it's the greatest time! command: .\HelloWorld
The program print Hello World! in terminal command line.
It's OK! I'm becoming a linux cpp programmer~!
Then I want to try makefile:
New a file named "makefile", and edit:
hello: HelloWorld.cpp
g++ HelloWorld.cpp -o hello
"hello" here means a target, if it's old or not exist, it will be made. The second line means the compile and link command.
Ok, I can use makefile to compile my cpp file now!
Good luck!
相关文章推荐
- How_to_build_an_ARM/DSP_Hello_World_program_on_the_DaVinci_EVM 续
- How can compile Mali-T764 DRIVERS on Ubuntu Linux 14.04 on RK3288 device
- Compile c/c++ program on ubuntu
- Compile Linux Kernel on Ubuntu 12.10
- U-boot-1.1.4中关于hello_world.srec出错 分类: DSP arm-linux-Ubuntu 2013-07-22 16:29 352人阅读 评论(0) 收藏
- arm-linux-gcc compile the cross-platform mpich2 on ubuntu
- TinyOS-2.1.1 Installation on Ubuntu 12.04 and Hello World
- My first bash program (running on Ubuntu 9.04) and Learnning tips
- Compile the latest Kernel(linux-3.1-rc4) On Ubuntu Plateform
- Compile Linux Kernel on Ubuntu 12.04 LTS
- How_to_build_an_ARM/DSP_Hello_World_program_on_the_DaVinci_EVM
- linux kernel stable compile on ubuntu
- Compile Linux Kernel on Ubuntu 12.04 LTS (Detailed)
- Compile the latest Kernel(linux-3.1-rc4) On Ubuntu Plateform
- How to Compile and Run C/C++ program on Ubuntu 11.10
- compile rtplib3.9.1 on linux(ubuntu 12.10)
- linux nasm helloworld
- Bluefish Linux下的web编辑神器-Hello,World
- How to fix “System program problem detected” error on Ubuntu
- My way on Linux - [虚拟化&云计算] - 云计算概述&KVM虚拟化基础