Note that there are some explanatory texts on larger screens.

plurals
  1. POcannot convert namespace_something::some_class to some_class
    text
    copied!<p>And both classes are same, example:</p> <pre><code>///////////////server.h////////////// #ifndef SERVER_H #define SERVER_H #ifdef WIN32 #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0501 #endif #endif #include &lt;boost/shared_ptr.hpp&gt; #include &lt;boost/asio.hpp&gt; #include &lt;map&gt; #include "auxiliar.h" class Client; namespace Irc { typedef boost::shared_ptr&lt;Client&gt; ClientPtr; typedef std::map&lt;SocketPtr, ClientPtr&gt; ClientsMap; class Server { public: Server(); ~Server(); void start(); void startAccept(); ClientsMap::const_iterator begin() { return m_clients.begin(); } ClientsMap::const_iterator end() { return m_clients.end(); } private: ClientsMap m_clients; boost::asio::io_service service; boost::asio::ip::tcp::acceptor* m_acceptor; }; } //namespace Irc #endif /////////////server.cpp//////////////// #include "server.h" #include "defines.h" #include "client.h" Irc::Server::Server() { service.run(); } Irc::Server::~Server() { m_clients.clear(); } void Irc::Server::start() { m_acceptor = new boost::asio::ip::tcp::acceptor(service, boost::asio::ip::tcp::endpoint( boost::asio::ip::tcp::v4(), SERVER_PORT)); } void Irc::Server::startAccept() { SocketPtr s(new boost::asio::ip::tcp::socket(service)); m_acceptor-&gt;accept(*s); Client *client = new Client(s); client-&gt;setIoService(&amp;service); ClientPtr ptr(client); m_clients.insert(std::make_pair(s, ptr)); } </code></pre> <p>This produces the compilation error:</p> <blockquote> <p>g++.exe -c src/server.cpp -o src/server.o -I"D:/Dev-Cpp/include" -g -ggdb -I"include" -fexpensive-optimizations -O1 D:/Dev-Cpp/include/boost/smart_ptr/shared_ptr.hpp: In constructor <code>boost::shared_ptr&lt; &lt;template-parameter-1-1&gt; &gt;::shared_ptr(Y*) [with Y = Irc::Client, T = Client]': src/server.cpp:27: instantiated from here D:/Dev-Cpp/include/boost/smart_ptr/shared_ptr.hpp:179: error: cannot convert</code>Irc::Client*' to `Client*' in initialization</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload