简体   繁体   中英

How can I use Google Benchmark on godbolt

I am trying to run some code on that uses Google Benchmark. I am trying to share it with some colleagues using Godbolt. It seems to support Google Benchmark as a library you can select but I can not get it to compile.

This is the link.
https://godbolt.org/z/dxvl5W

It is using gcc 7.3 with these options:
-std=c++17 -O3 -lbenchmark

I tried adding -lbenchmark and -lbenachmark-main . None resolve the issue.

This is the error I am getting

ASM generation compiler returned: 0

/opt/compiler-explorer/gcc-7.3.0/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../x86_64-linux-gnu/bin/ld: cannot find -lbenchmark

collect2: error: ld returned 1 exit status

Execution build compiler returned: 1

How can I use Google Benchmark on godbolt

As it stands - you can't.

Now you can use quick-bench to microbenchmark. Just click the quick-bench link in godbolt or go to: https://quick-bench.com/ It supports google benchmark.

For your code sample: https://quick-bench.com/q/X4VuveQHPfc8fFrk8sbbMEoVVx0

Godbolt lets you #include by url.

#include "https://raw.githubusercontent.com/google/benchmark/master/include/benchmark/benchmark.h"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM