Zaphoydは、Websocketbroadcast_server.cpp
サーバーの完璧なバックボーンのように見えます。これは、通信を中断しないように、実際のアクションのためのスレッドとのメッセージと接続をすばやく受け入れて送信できます。 https://github.com/zaphoyd/websocketpp/blob/experimental/examples/broadcast_server/broadcast_server.cpp
彼の単純なprint_server.cpp
例は簡単にコンパイルできます。ただし、でいくつかのコンパイル エラーが発生しbroadcast_server.cpp
ます。
root@server:~# g++ -O3 broadcast_server.cpp -I ~/websocketpp-experimental/ -lboost_system
broadcast_server.cpp:126:37: error: 'owner_less' is not a member of 'std'
broadcast_server.cpp:126:37: error: 'owner_less' is not a member of 'std'
broadcast_server.cpp:126:70: error: 'con_list' was not declared in this scope
broadcast_server.cpp:126:70: error: template argument 2 is invalid
broadcast_server.cpp:126:18: warning: 'typedef' was ignored in this declaration [enabled by default]
broadcast_server.cpp:129:5: error: 'con_list' does not name a type
broadcast_server.cpp: In member function 'void broadcast_server::process_messages()':
broadcast_server.cpp:109:17: error: 'm_connections' was not declared in this scope
broadcast_server.cpp:112:17: error: 'm_connections' was not declared in this scope
broadcast_server.cpp:116:17: error: 'con_list' has not been declared
broadcast_server.cpp:116:36: error: expected ';' before 'it'
broadcast_server.cpp:117:22: error: 'it' was not declared in this scope
broadcast_server.cpp:117:27: error: 'm_connections' was not declared in this scope
私は c++ を初めて使用します。これらはおそらく単純な問題ですが、解決方法がわかりません。
'owner_less' is not a member of 'std'
? http://en.cppreference.com/w/cpp/memory/owner_less
template argument 2
error
上記が解決すれば解消されると思います。
'con_list' was not declared in this scope
いつそこにあるのprivate:
ですか?と同じ'm_connections'
?
'con_list' has not been declared
上記のエラーが発生すると、それはなくなると思います。
'it'
それが何について話しているのか、なぜその前にあるべきなのかわかりません;
。
バージョン
Ubuntu 12.10
gcc --version
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
ブースト 1.53.0
余分#include
な
#include <cstdlib>
#include <iostream>
#include <memory>
#include <set>
まだ何もない
-std=c++11
In file included from /usr/include/c++/4.7/map:60:0,
from /usr/local/include/boost/date_time/gregorian/greg_month.hpp:18,
from /usr/local/include/boost/date_time/gregorian/greg_ymd.hpp:16,
from /usr/local/include/boost/date_time/gregorian/greg_calendar.hpp:16,
from /usr/local/include/boost/date_time/gregorian/gregorian_types.hpp:19,
from /usr/local/include/boost/date_time/posix_time/posix_time_config.hpp:18,
from /usr/local/include/boost/date_time/posix_time/posix_time_system.hpp:13,
from /usr/local/include/boost/date_time/posix_time/ptime.hpp:12,
from /usr/local/include/boost/date_time/posix_time/posix_time_types.hpp:12,
from /usr/local/include/boost/thread/thread_time.hpp:11,
from /usr/local/include/boost/thread/lock_types.hpp:18,
from /usr/local/include/boost/thread/pthread/thread_data.hpp:12,
from /usr/local/include/boost/thread/thread.hpp:17,
from /usr/local/include/boost/thread.hpp:13,
from /root/websocketpp-experimental/websocketpp/common/thread.hpp:41,
from /root/websocketpp-experimental/websocketpp/concurrency/basic.hpp:31,
from /root/websocketpp-experimental/websocketpp/config/core.hpp:35,
from /root/websocketpp-experimental/websocketpp/config/asio_no_tls.hpp:31,
from broadcast_server.cpp:1:
/usr/include/c++/4.7/bits/stl_tree.h: In instantiation of 'class std::_Rb_tree<boost::weak_ptr<void>, boost::weak_ptr<void>, std::_Identity<boost::weak_ptr<void> >, std::owner_less<boost::weak_ptr<void> >, std::allocator<boost::weak_ptr<void> > >':
/usr/include/c++/4.7/bits/stl_set.h:116:17: required from 'class std::set<boost::weak_ptr<void>, std::owner_less<boost::weak_ptr<void> > >'
broadcast_server.cpp:132:14: required from here
/usr/include/c++/4.7/bits/stl_tree.h:471:31: error: invalid use of incomplete type 'struct std::owner_less<boost::weak_ptr<void> >'
In file included from /usr/include/c++/4.7/bits/shared_ptr.h:52:0,
from /usr/include/c++/4.7/memory:87,
from /usr/local/include/boost/config/no_tr1/memory.hpp:21,
from /usr/local/include/boost/smart_ptr/shared_ptr.hpp:27,
from /usr/local/include/boost/shared_ptr.hpp:17,
from /usr/local/include/boost/date_time/time_clock.hpp:17,
from /usr/local/include/boost/thread/thread_time.hpp:9,
from /usr/local/include/boost/thread/lock_types.hpp:18,
from /usr/local/include/boost/thread/pthread/thread_data.hpp:12,
from /usr/local/include/boost/thread/thread.hpp:17,
from /usr/local/include/boost/thread.hpp:13,
from /root/websocketpp-experimental/websocketpp/common/thread.hpp:41,
from /root/websocketpp-experimental/websocketpp/concurrency/basic.hpp:31,
from /root/websocketpp-experimental/websocketpp/config/core.hpp:35,
from /root/websocketpp-experimental/websocketpp/config/asio_no_tls.hpp:31,
from broadcast_server.cpp:1:
/usr/include/c++/4.7/bits/shared_ptr_base.h:270:12: error: declaration of 'struct std::owner_less<boost::weak_ptr<void> >'
インストール方法(依存関係、実際のプログラムなど)
https://github.com/zaphoyd/websocketpp/wiki/Setup-0.3X-on-Ubuntu-12.10
代替歓迎
に代わるものがある場合はstd::owner_less
、投稿してください。