OpenWebTorrent / openwebtorrent-tracker

Fast and simple Webtorrent tracker implementation in C++
https://openwebtorrent.com
71 stars 22 forks source link

clang: 'auto' not allowed in function prototype #8

Closed subins2000 closed 3 years ago

subins2000 commented 4 years ago

Hi

I'm trying to cross compile this for Android. Android NDK uses clang, and apparently it doesn't support auto in functions : https://stackoverflow.com/questions/30665506/auto-not-allowed-in-function-prototype-with-clang

Error log :

/home/mint/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/mint/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/mint/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -Dtracker_EXPORTS -I. -I/home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp -I/home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/deps/uWebSockets/src -I/home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/deps/json/single_include/nlohmann -I/home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/src -I/home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/deps/uWebSockets/uSockets/src -I/home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openssl/output/usr/local/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -std=c++2a -g -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/tracker.dir/tracker.cpp.o -MF CMakeFiles/tracker.dir/tracker.cpp.o.d -o CMakeFiles/tracker.dir/tracker.cpp.o -c /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/tracker.cpp
  In file included from /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/tracker.cpp:4:
  In file included from /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/src/WebtorrentTracker.h:14:
  In file included from /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/src/Swarm.h:9:
  /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/src/PeerContext.h:28:14: error: 'auto' not allowed in function prototype
          PeerContext(auto* ws, std::string id = "") {
                      ^~~~
  In file included from /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/tracker.cpp:4:
  /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/src/WebtorrentTracker.h:137:14: error: 'auto' not allowed in function prototype
          void onOpen(auto* ws, auto* req) {
                      ^~~~
  /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/src/WebtorrentTracker.h:137:24: error: 'auto' not allowed in function prototype
          void onOpen(auto* ws, auto* req) {
                                ^~~~
  /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/src/WebtorrentTracker.h:147:17: error: 'auto' not allowed in function prototype
          void onMessage(auto* ws, std::string_view message, uWS::OpCode opCode) {
                         ^~~~
  /home/mint/Other/Projects/GitHub/Dots/app/src/main/cpp/openwebtorrent-tracker/src/WebtorrentTracker.h:169:15: error: 'auto' not allowed in function prototype
          void onClose(auto* ws, int code, std::string_view message) {
                       ^~~~
  5 errors generated.
  ninja: build stopped: subcommand failed.

Is there an alternative to using auto and then get it compiled ? I don't know C++ really.