Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including sio_socket.h and compilation wit clang fails. #16

Closed
TimZaman opened this issue May 21, 2015 · 6 comments
Closed

Including sio_socket.h and compilation wit clang fails. #16

TimZaman opened this issue May 21, 2015 · 6 comments

Comments

@TimZaman
Copy link

In file included from /usr/local/include/sio_client.h:12:
/usr/local/include/sio_socket.h:73:31: error: expected ')'
        void emit(std::string const& name, message::list const& msglist = nullptr, std::function<void (message::ptr const&)> const& ack = nullptr);
                              ^
/usr/local/include/sio_socket.h:73:18: note: to match this '('
        void emit(std::string const& name, message::list const& msglist = nullptr, std::function<void (message::ptr const&)> const& ack = nullptr);
                 ^
/usr/local/include/sio_socket.h:73:24: error: non-friend class member 'string' cannot have a qualified name
        void emit(std::string const& name, message::list const& msglist = nullptr, std::function<void (message::ptr const&)> const& ack = nullptr);
                  ~~~~~^
/usr/local/include/sio_socket.h:73:24: error: field has incomplete type 'void'
3 errors generated.

** BUILD FAILED **

The issue resembles one (http://stackoverflow.com/questions/16759025/two-level-nested-c-class-works-with-gcc-but-fails-with-clang) where another compiler is possibly too permissive. Hence, a possible violation of _ (...) In such cases, the nested-name-specifier of the class-head-name of the definition shall not begin with a decltype-specifier._
Any ideas where this error might come from?

@TimZaman TimZaman changed the title Including sio_socket and compilation wit clang fails. Including sio_client and compilation wit clang fails. May 21, 2015
@TimZaman TimZaman changed the title Including sio_client and compilation wit clang fails. Including sio_socket.h and compilation wit clang fails. May 21, 2015
@TimZaman
Copy link
Author

Also minor thing in your readme:
//emit event name only: socket->emit("login"); //emit text h.socket()->emit("add user", username);
should be
//emit event name only: h.socket->emit("login"); //emit text h.socket()->emit("add user", username);

@melode11
Copy link
Contributor

Thanks for reporting, but it seems OK on my clang.
Did you add c++11 options on your compiler.

@TimZaman
Copy link
Author

Yes i did. Problem is that i always use cmake.
I found them problem. boost signals do not work together with those of qt. I had to specify no_keywords in cmake like this:
ADD_DEFINITIONS(-DQT_NO_KEYWORDS) #makes boost signals work together with qt's when using cmake
Excellent library, melode11, much appreated. bows

@Warren93
Copy link

Warren93 commented Feb 4, 2021

I can't use the solution mentioned above because it appears to break Qt's signals. Also, I'm using gcc 4.8.5, not clang as in the original issue. Is there an alternative, straightforward fix for this compiler error?

@zhuzongzhi
Copy link

q

Yes i did. Problem is that i always use cmake. I found them problem. boost signals do not work together with those of qt. I had to specify no_keywords in cmake like this: ADD_DEFINITIONS(-DQT_NO_KEYWORDS) #makes boost signals work together with qt's when using cmake Excellent library, melode11, much appreated. bows

qmake like that: DEFINES += QT_NO_KEYWORDS in *.pro file.

@MrJamesLZA
Copy link

q

Yes i did. Problem is that i always use cmake. I found them problem. boost signals do not work together with those of qt. I had to specify no_keywords in cmake like this: ADD_DEFINITIONS(-DQT_NO_KEYWORDS) #makes boost signals work together with qt's when using cmake Excellent library, melode11, much appreated. bows

qmake like that: DEFINES += QT_NO_KEYWORDS in *.pro file.

nice~this suggestion works!
tks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants