Compilation error
trusnak opened this issue · comments
Tomas Rusnak commented
There is a compilation error:
- gcc version 11.2.0 (Gentoo 11.2.0 p1)
- cmake version 3.21.4
In file included from /home/mmbot/mmbot/src/brokers/kucoin/main.cpp:10:
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.h:58:22: error: ‘optional’ in namespace ‘std’ does not name a template type
58 | mutable std::optional<OrderMap> orderMap;
| ^~~~~~~~
In file included from /home/mmbot/mmbot/src/brokers/kucoin/main.cpp:10:
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.h:8:1: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
7 | #include "../httpjson.h"
+++ |+#include <optional>
8 |
In file included from /home/mmbot/mmbot/src/brokers/kucoin/kucoin.cpp:1:
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.h:58:22: error: ‘optional’ in namespace ‘std’ does not name a template type
58 | mutable std::optional<OrderMap> orderMap;
| ^~~~~~~~
In file included from /home/mmbot/mmbot/src/brokers/kucoin/kucoin.cpp:1:
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.h:8:1: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
7 | #include "../httpjson.h"
+++ |+#include <optional>
8 |
make[2]: *** [src/brokers/kucoin/CMakeFiles/kucoin.dir/build.make:76: src/brokers/kucoin/CMakeFiles/kucoin.dir/main.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.cpp: In member function ‘virtual bool KucoinIFC::reset()’:
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.cpp:309:9: error: ‘orderMap’ was not declared in this scope; did you mean ‘OrderMap’?
309 | orderMap.reset();
| ^~~~~~~~
| OrderMap
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.cpp: In member function ‘void KucoinIFC::updateOrders()’:
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.cpp:314:14: error: ‘orderMap’ was not declared in this scope; did you mean ‘OrderMap’?
314 | if (!orderMap.has_value()) {
| ^~~~~~~~
| OrderMap
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.cpp: In member function ‘virtual IStockApi::Orders KucoinIFC::getOpenOrders(const string_view&)’:
/home/mmbot/mmbot/src/brokers/kucoin/kucoin.cpp:340:30: error: ‘orderMap’ was not declared in this scope; did you mean ‘OrderMap’?
340 | for (const auto &x: *orderMap) {
| ^~~~~~~~
| OrderMap
make[2]: *** [src/brokers/kucoin/CMakeFiles/kucoin.dir/build.make:90: src/brokers/kucoin/CMakeFiles/kucoin.dir/kucoin.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:921: src/brokers/kucoin/CMakeFiles/kucoin.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 79%] Linking CXX executable ../../bin/mmbot
[ 99%] Built target mmbot
make: *** [Makefile:136: all] Error 2
Ondrej Novak commented
should be resolved by #32
Some GCC installations (ubuntu] includes this header into some standard C++ headers, so I can compile it without noticing that something is wrong.
Thank you for reporting.