-
Notifications
You must be signed in to change notification settings - Fork 108
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
Using in conjunction with Qt #120
Comments
@EosPengwern thanks for reporting, and sorry for the very late reply. The You can verify the above by doing this: #include <QFileDialog>
#ifdef emit
#error "qt is leaking emit"
#endif Or you can do a workaround like this: #include <QFileDialog>
#undef emit
#include <ryml.hpp> HTH! I'm closing as the problem comes from Qt and not ryml. |
I think it is a problem of ryml that the library is incompatible with a very popular C++ framework. The bigger library wins, and their define is older :) |
Thanks for reopening the issue and considering my request to look into it. At the very least, may I suggest including this caveat and the solution (#undef) into README? |
You made a sound argument. I plan on adding a |
That is a great idea, it didn't occur to me! The only other solution is to rename |
I've found a workaround for this problem. I've written: `#undef emit #include "rapidyaml-0.4.1.hpp" #define emit` And the software I'm working on compiles fine with Qt. But I had to limit usage of rapidyaml to a single class so that the problem doesn't emerge anywhere else. This solution wont'be convenient for a software with a wider rapidyaml usage, so method renaming would be very welcome. |
@kdidkovsky if you put all of that into a header (wrapping the include), the limit goes away. Eg, like this: // myrapidyaml.h
#pragma once // or a plain old #ifdef include guard
#undef emit
#include "rapidyaml-0.4.1.hpp" Then just use your header everywhere: // file1.cpp
#include "myrapidyaml.h"
// file2.cpp
#include "myrapidyaml.h" ... and you can do this without any limits on usage. That's easy, no? To be clear, I will not rename the |
That's workable, but annoying to have to do. I would, of course, not rename the |
This problem has been bothering me, because there's really no optimal solution. With the view of long term comfort, I've reconsidered, and decided to deprecate |
so, is it successful to compile ryml in QT now? |
If I #include a Qt header (specifically, the one I tried was
<QFileDialog>
) before including ryml.hpp, I get a compilation error:(test.cpp - an otherwise empty file):
gives me on Linux (Qt 5.15.2 with gcc 8.1):
and on Windows (with the same version of Qt and VS2019):
...and many more in a similar vein. If I simply swap around the order of the two includes, putting ryml.hpp first, then everything works fine, on both platforms.
The text was updated successfully, but these errors were encountered: