Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error with benchmark.h (after installing google-benchmark) #931

Closed
MedericFourmy opened this issue Nov 28, 2018 · 1 comment
Closed

Comments

@MedericFourmy
Copy link

MedericFourmy commented Nov 28, 2018

Hello, have a compiling issue with benchmark.h I think. I followed issue #918 and installed google-benchmark following the github explanations but now I have the following compilation error:

/usr/local/include/benchmark/benchmark.h: In instantiation of ‘benchmark::RegisterBenchmark(const 
char*, Lambda&&, Args&& ...)::<lambda(benchmark::State&)> [with Lambda = void (&) 
(benchmark::State&, std::__cxx11::basic_string<char>); Args = {std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&}]’:
/usr/local/include/benchmark/benchmark.h:1042:48:   required from ‘struct 
benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...) [with Lambda = void (&) 
(benchmark::State&, std::__cxx11::basic_string<char>); Args = {std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&}]::<lambda(class benchmark::State&)>’
/usr/local/include/benchmark/benchmark.h:1041:38:   required from ‘benchmark::internal::Benchmark* 
benchmark::RegisterBenchmark(const char*, Lambda&&, Args&& ...) [with Lambda = void (&) 
(benchmark::State&, std::__cxx11::basic_string<char>); Args = {std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&}]’
bench/formatter-bench.cpp:49:79:   required from here
/usr/local/include/benchmark/benchmark.h:1042:41: error: variable ‘fn’ has function type
       name, [=](benchmark::State& st) { fn(st, args...); });
                                     ^
 compilation terminated due to -Wfatal-errors.

Is my installation of google-benchmark faulty?

@kamontia
Copy link

kamontia commented Dec 5, 2018

@MedericFourmy I also have the same problem. What version do you try to build?

In my environment, success to build spdlog using v1.2.1 tag.

$ git checkout v1.2.1
Previous HEAD position was 4003218 Merge branch 'v1.x' of https://github.com/gabime/spdlog into v1.x
HEAD is now at 10e809c Merge pull request #864 from DimRochette/v1.x

$ cmake..

$ make -j2
Scanning dependencies of target multisink
[  4%] Building CXX object example/CMakeFiles/multisink.dir/multisink.cpp.o
Scanning dependencies of target example
[  8%] Building CXX object example/CMakeFiles/example.dir/example.cpp.o
[ 13%] Linking CXX executable multisink
[ 13%] Built target multisink
Scanning dependencies of target spdlog-utests
[ 17%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/errors.cpp.o
[ 21%] Linking CXX executable example
[ 21%] Built target example
Scanning dependencies of target async_bench
[ 26%] Building CXX object bench/CMakeFiles/async_bench.dir/async_bench.cpp.o
[ 30%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/file_helper.cpp.o
[ 34%] Linking CXX executable async_bench
[ 34%] Built target async_bench
Scanning dependencies of target bench
[ 39%] Building CXX object bench/CMakeFiles/bench.dir/bench.cpp.o
[ 43%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/file_log.cpp.o
[ 47%] Linking CXX executable bench
[ 47%] Built target bench
Scanning dependencies of target latency
[ 52%] Building CXX object bench/CMakeFiles/latency.dir/latency.cpp.o
[ 56%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/test_misc.cpp.o
[ 60%] Linking CXX executable latency
[ 60%] Built target latency
[ 65%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/test_pattern_formatter.cpp.o
[ 69%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/test_async.cpp.o
[ 73%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/registry.cpp.o
[ 78%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/test_macros.cpp.o
[ 82%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/utils.cpp.o
[ 86%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/test_mpmc_q.cpp.o
[ 91%] Building CXX object tests/CMakeFiles/spdlog-utests.dir/test_fmt_helper.cpp.o
[ 95%] Linking CXX executable spdlog-utests
[100%] Built target spdlog-utests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants