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

Problem with the emit function when compiling with Qt #3

Open
rodolphekafe opened this issue Dec 17, 2012 · 2 comments
Open

Problem with the emit function when compiling with Qt #3

rodolphekafe opened this issue Dec 17, 2012 · 2 comments

Comments

@rodolphekafe
Copy link

Hello,

Your library is awesome, but I had some problems when using it with Qt. Indeed, one of your function is called "emit", the problem is that in Qt, this is a keyword, so I had to change the name of this function in you source files (well, I just called it emitt xD).

You should rename it to avoid conflicts.

Regards,

Rodolphe Fouquet.

@ebshimizu
Copy link
Owner

That function name attempts to match the conventions of the socket.io, so i'd prefer to keep it as emit if possible.
I'm not really familiar with Qt, but does it #define any constants to indicate that it's being used? If it does, I can add in a section that defines an identical function of a different name. Or if not, we'll just have to add an option to use a function with a different name.

@sunnipaul
Copy link

sunnipaul commented Sep 20, 2016

For those who may have this issue nowadays, I met similar issue recently.
I'm using Visual Studio 2015. The code won't compile successfully using this lib with Qt.
The reason is that Qt defined emit for event emitting which conflict with this lib.
Here is the solution I found, which temporarily disable this macro and restore it later :

#pragma push_macro("emit")
#undef emit
        client.socket()->emit("message", std::string(message));
#pragma pop_macro("emit")

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

3 participants