海黎祈祷中

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  27 随笔 :: 0 文章 :: 5 评论 :: 48215 阅读
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

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!

 

posted on   海黎  阅读(412)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示