kvak
kvak copied to clipboard
added include for <optional> in G++17
To fix an Error Message i was getting while compiling this in an Ubuntu Jammy container running on Balena OS (x86_64)
Consolidate compiler generated dependencies of target kvak
[ 5%] Building CXX object CMakeFiles/kvak.dir/main.cpp.o
[ 11%] Building CXX object CMakeFiles/kvak.dir/costas.cpp.o
[ 17%] Building CXX object CMakeFiles/kvak.dir/demodulator.cpp.o
In file included from /app/kvak/demodulator.cpp:6:
/app/kvak/log.hpp:59:22: error: ‘optional’ in namespace ‘std’ does not name a template type
59 | std::optional<std::reference_wrapper<std::ostream>> stream;
| ^~~~~~~~
/app/kvak/log.hpp:8:1: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
7 | #include <string.h>
+++ |+#include <optional>
8 |
/app/kvak/log.hpp:85:14: error: ‘optional’ in namespace ‘std’ does not name a template type
85 | std::optional<std::reference_wrapper<std::ostream>> stream;
| ^~~~~~~~
/app/kvak/log.hpp:85:9: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
85 | std::optional<std::reference_wrapper<std::ostream>> stream;
| ^~~
/app/kvak/log.hpp: In constructor ‘kvak::log::log_wrapper::log_wrapper(const string&, std::ostream&)’:
/app/kvak/log.hpp:26:17: error: class ‘kvak::log::log_wrapper’ does not have any field named ‘stream’
26 | stream(stream)
| ^~~~~~
/app/kvak/log.hpp: In constructor ‘kvak::log::log_wrapper::log_ender::log_ender(std::ostream&)’:
/app/kvak/log.hpp:38:25: error: class ‘kvak::log::log_wrapper::log_ender’ does not have any field named ‘stream’
38 | stream(stream)
| ^~~~~~
/app/kvak/log.hpp: In destructor ‘kvak::log::log_wrapper::log_ender::~log_ender()’:
/app/kvak/log.hpp:44:35: error: ‘class kvak::log::log_wrapper::log_ender’ has no member named ‘stream’
44 | if (this->stream) {
| ^~~~~~
/app/kvak/log.hpp:45:39: error: ‘class kvak::log::log_wrapper::log_ender’ has no member named ‘stream’
45 | this->stream.value().get() << "\x1b[0m" << std::endl;
| ^~~~~~
/app/kvak/log.hpp: In member function ‘kvak::log::log_wrapper::log_ender& kvak::log::log_wrapper::log_ender::operator<<(T&&)’:
/app/kvak/log.hpp:52:35: error: ‘class kvak::log::log_wrapper::log_ender’ has no member named ‘stream’
52 | if (this->stream) {
| ^~~~~~
/app/kvak/log.hpp:53:39: error: ‘class kvak::log::log_wrapper::log_ender’ has no member named ‘stream’
53 | this->stream.value().get() << val;
| ^~~~~~
/app/kvak/log.hpp: In member function ‘void kvak::log::log_wrapper::mute()’:
/app/kvak/log.hpp:64:23: error: ‘class kvak::log::log_wrapper’ has no member named ‘stream’
64 | this->stream.reset();
| ^~~~~~
/app/kvak/log.hpp: In member function ‘void kvak::log::log_wrapper::redirect(std::ostream&)’:
/app/kvak/log.hpp:69:23: error: ‘class kvak::log::log_wrapper’ has no member named ‘stream’
69 | this->stream = stream;
| ^~~~~~
/app/kvak/log.hpp: In member function ‘kvak::log::log_wrapper::log_ender kvak::log::log_wrapper::operator<<(T&&)’:
/app/kvak/log.hpp:76:28: error: ‘class kvak::log::log_wrapper’ has no member named ‘stream’
76 | if (!this->stream) {
| ^~~~~~
/app/kvak/log.hpp:79:40: error: ‘class kvak::log::log_wrapper’ has no member named ‘stream’
79 | return log_ender(this->stream.value().get() << this->prefix << val);
| ^~~~~~
make[2]: *** [CMakeFiles/kvak.dir/build.make:115: CMakeFiles/kvak.dir/demodulator.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/kvak.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Thanks for the fix. For me there was still an #include <array>
missing in resample.cpp
, causing
kvak/resample.cpp: In function ‘int main(int, char**)’:
kvak/resample.cpp:29:51: error: aggregate ‘std::array<std::complex<float>, 8192> data’ has incomplete type and cannot be defined
29 | std::array<std::complex<float>, 1024 * 8> data;
| ^~~~