ggerganov / kbd-audio

🎤⌨️ Acoustic keyboard eavesdropping
https://ggerganov.github.io/keytap
MIT License
8.54k stars 586 forks source link

Error during make #11

Closed FanWT closed 4 years ago

FanWT commented 5 years ago

$ make [ 2%] Building CXX object CMakeFiles/Core.dir/audio_logger.cpp.o [ 4%] Linking CXX static library libCore.a [ 4%] Built target Core [ 7%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui.cpp.o [ 9%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui_draw.cpp.o [ 11%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui_demo.cpp.o [ 14%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui_widgets.cpp.o [ 16%] Building C object CMakeFiles/ImGui.dir/imgui/examples/libs/gl3w/GL/gl3w.c.o [ 19%] Building CXX object CMakeFiles/ImGui.dir/imgui/examples/imgui_impl_sdl.cpp.o [ 21%] Building CXX object CMakeFiles/ImGui.dir/imgui/examples/imgui_impl_opengl3.cpp.o [ 23%] Linking CXX static library libImGui.a [ 23%] Built target ImGui [ 26%] Building CXX object CMakeFiles/view-full-gui.dir/view-full-gui.cpp.o /home/fwt/kbd-audio/view-full-gui.cpp: In function ‘bool generateLowResWaveform(const TWaveformView&, TWaveform&, int)’: /home/fwt/kbd-audio/view-full-gui.cpp:116:10: error: expected unqualified-id before ‘[’ token auto [samples, n] = waveform; ^ /home/fwt/kbd-audio/view-full-gui.cpp:118:27: error: ‘n’ was not declared in this scope TWaveform waveformAbs(n); ^ /home/fwt/kbd-audio/view-full-gui.cpp:120:35: error: ‘samples’ was not declared in this scope waveformAbs[i] = std::abs(samples[i]); ^ CMakeFiles/view-full-gui.dir/build.make:62: recipe for target 'CMakeFiles/view-full-gui.dir/view-full-gui.cpp.o' failed make[2]: [CMakeFiles/view-full-gui.dir/view-full-gui.cpp.o] Error 1 CMakeFiles/Makefile2:73: recipe for target 'CMakeFiles/view-full-gui.dir/all' failed make[1]: [CMakeFiles/view-full-gui.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

it seems like that this occurs because the compiler can not understand the keyword "auto". However I have upgrade my cmake to 3.13 and CMakeLists.txt : set (CMAKE_CXX_STANDARD 17) is working now. How to solve this? Should I upgrade my g++ or gcc?

ggerganov commented 5 years ago

I'm using some C++17 features that are only available in later GCC versions. In your case, the "structured binding" feature is available in GCC 7 and later.

So either upgrade to GCC 7 or wait for me (or someone else) to remove these C++17 stuff. No ETA on that.

Edit: here is a list of GCC features - link

ggerganov commented 5 years ago

726ffdc4676ff24413b6a8b10e588c352a57f73b removes C++17 stuff. Should be able to build now with C++14 support (i.e. older CMake and older GCC).

FanWT commented 5 years ago

thanks for help and I can build it now, but neither ./record nor ./record-full works.

$sudo ./record output Recording 5 frames per key press Found 1 capture devices:

$sudo ./record-full output Found 1 capture devices:

There is just one device#0 no matter I plug in the microphone or not. It looks like my microphone cant get detected. Any solutions or did i get something wrong in build or config?

ggerganov commented 5 years ago

This looks like an SDL issue - not detecting your mic for some reason. I think SDL capture support was introduced in 2.0.5, so this might be related. What is your SDL version? Try upgrading to >= 2.0.5