百度Apollo踩坑笔记(三)Hello world

5 篇文章 0 订阅
4 篇文章 0 订阅

I preparing for an examination a year, so paused the learning for a year, now I come back.
I write the blog on Ubuntu. I’m so lazy that I haven’t install Chinese Pinyin. That’s why I write it in English. If There are many mistakes please tell me, thanks.
切回Windows写中文

Write "HelloWorld"编写“HelloWorld”

In last blog I had finished build CyberRT, so I make a Hello World Demo.
在上一篇博客中,我完成了CyberRT框架的编译,所以我做了HelloWorld示例。

mkdir cyber/Demo_cc

Source Code源码

vim HelloWold.cc
#include "cyber/cyber.h"

int main(int argc, char *argv[])
{
    apollo::cyber::Init(argv[0]);//初始化CyberRT框架
    AINFO << "Hello World";//输出Hello World
    return 0;
}

BUILD File BUILD文件

cc_binary(
    name = "HelloWorld",
    srcs = ["HelloWorld.cc"],
    deps = ["//cyber"],
)

Build Command构建命令

bazel build cyber/demo_cc/...

Then I have built the program. And the binary file in
这样我就完成了构建程序。二进制文件存放在

/bazel-bin/cyber/demo_cc

Run运行

Before running, I have to change the setup.bash
在运行前,需要更改setup.bash

vim cyber/setup.bash

Find the
找到

export GLOG_alsologtostderr=0

Change it as
将它改为

export GLOG_alsologtostderr=1

This is used to display the message in terminate, if not do it, you can’t see anything on your terminate.
这是用于在终端中显示信息,如果没有做这一步,终端上不会有任何信息。
At last
最后

./bazel-bin/cyber/demo_cc/HelloWorld

Now you can see “Hello World” on your screen.
现在你可以在屏幕上看到“Hello World”

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值