websocketpp
websocketpp copied to clipboard
when use c++20, compile failed
In file included from /home/hijiang/code/mms/build/include/websocketpp/config/core.hpp:51,
from /home/hijiang/code/mms/build/include/websocketpp/config/asio_no_tls.hpp:31,
from /home/hijiang/code/mms/src/server/webrtc/webrtc_session.hpp:6,
from /home/hijiang/code/mms/src/server/webrtc/webrtc_server.hpp:5,
from /home/hijiang/code/mms/src/main.cpp:18:
/home/hijiang/code/mms/build/include/websocketpp/logger/basic.hpp:100:54: error: expected ‘)’ before ‘&&’ token
100 | basic<concurrency,names>(basic<concurrency,names> && other)
| ~ ^~~
| )
In file included from /home/hijiang/code/mms/build/include/websocketpp/roles/server_endpoint.hpp:31,
from /home/hijiang/code/mms/build/include/websocketpp/server.hpp:31,
from /home/hijiang/code/mms/src/server/webrtc/webrtc_session.hpp:7,
from /home/hijiang/code/mms/src/server/webrtc/webrtc_server.hpp:5,
from /home/hijiang/code/mms/src/main.cpp:18:
/home/hijiang/code/mms/build/include/websocketpp/endpoint.hpp:112:5: error: template-id not allowed for destructor
112 | ~endpoint<connection,config>() {}
| ^
In file included from /home/hijiang/code/mms/build/include/websocketpp/server.hpp:31,
from /home/hijiang/code/mms/src/server/webrtc/webrtc_session.hpp:7,
from /home/hijiang/code/mms/src/server/webrtc/webrtc_server.hpp:5,
from /home/hijiang/code/mms/src/main.cpp:18:
/home/hijiang/code/mms/build/include/websocketpp/roles/server_endpoint.hpp:75:5: error: template-id not allowed for destructor
75 | ~server
I get the same error. The reason is the changed wording in the class section of the C++20 standard paper.
When using C++20, this code is invalid:
template <typename T>
struct Foo {
Foo<T>() { }
~Foo<T>() { }
};
The <T> part has to be omitted.
Apparently, MSVC doesn't enforce this rule, but GCC 10.2 from my WSL2 Ubuntu does.
Same problem. Here is my log:
Click here to expand log
[ 50%] Building CXX object CMakeFiles/AccountApiServer.dir/src/main.cpp.o
In file included from /home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/config/core.hpp:51,
from /home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/config/asio_no_tls.hpp:31,
from /home/elnee/.primebridge/common/include/common/web_socket/web_socket_server.h:5,
from /home/elnee/work/PrimeBridge-Backend/account_api_server/src/main.cpp:9:
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/logger/basic.hpp:61:54: error: expected ‘)’ before ‘h’
61 | basic<concurrency,names>(channel_type_hint::value h =
| ~ ^~
| )
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/logger/basic.hpp:67:42: error: expected ‘)’ before ‘*’ token
67 | basic<concurrency,names>(std::ostream * out)
| ~ ^~
| )
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/logger/basic.hpp:72:35: error: expected ‘)’ before ‘c’
72 | basic<concurrency,names>(level c, channel_type_hint::value h =
| ~ ^~
| )
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/logger/basic.hpp:78:35: error: expected ‘)’ before ‘c’
78 | basic<concurrency,names>(level c, std::ostream * out)
| ~ ^~
| )
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/logger/basic.hpp:84:5: error: template-id not allowed for destructor
84 | ~basic<concurrency,names>() {}
| ^
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/logger/basic.hpp:87:54: error: expected ‘)’ before ‘const’
87 | basic<concurrency,names>(basic<concurrency,names> const & other)
| ~ ^~~~~~
| )
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/logger/basic.hpp:100:54: error: expected ‘)’ before ‘&&’ token
100 | basic<concurrency,names>(basic<concurrency,names> && other)
| ~ ^~~
| )
In file included from /home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/roles/server_endpoint.hpp:31,
from /home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/server.hpp:31,
from /home/elnee/.primebridge/common/include/common/web_socket/web_socket_server.h:6:
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/endpoint.hpp:112:5: error: template-id not allowed for destructor
112 | ~endpoint<connection,config>() {}
| ^
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/roles/server_endpoint.hpp:75:5: error: template-id not allowed for destructor
75 | ~server<config>() {}
| ^
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/roles/server_endpoint.hpp:79:34: error: expected ‘)’ before ‘&’ token
79 | server<config>(server<config> &) = delete;
| ~ ^~
| )
/home/elnee/.conan/data/websocketpp/0.8.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/websocketpp/roles/server_endpoint.hpp:87:34: error: expected ‘)’ before ‘&&’ token
87 | server<config>(server<config> && o) : endpoint<connection<config>,config>(std::move(o)) {}
| ~ ^~~
| )
How we can fix that problem?
It is not a real fix but lowering cxx version to c++17 solved this same issue for me
You can either use the develop branch which contains a fix for this, downgrade to C++17, or apply a patch like https://patch-diff.githubusercontent.com/raw/zaphoyd/websocketpp/pull/1060.patch
This is a duplicate of #1058 and probably many others.