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!
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步