Closed lgbaldoni closed 3 years ago
Replacing proper symbols with defines doesn't sound like a particularly good idea. It doesn't sound that bad either, though.
But that particular define looks terribly wrong. Why \n
? Is it what Qt defines as endl
? I'm not sure. There can be more to it.
I need to look into it further, but I need to know what OS and compiler you're using. I have absolutely no problems on all systems and compilers I test QuaZip with.
I need to look into it further, but I need to know what OS and compiler you're using. I have absolutely no problems on all systems and compilers I test QuaZip with.
The failure occurs on openSUSE Leap 15.3 beta with the stock gcc 7.5.0. compiler. I think I tried version 10 too but with no change.
I've finally found some time to look into it. Looks like someone did a using namespace std
or using std::endl
before including QuaZip headers. Unfortunately, this causes name clash with Qt's endl
which is a global function (not \n
!). I could find no workaround, even referring explicitly to ::endl
or QT_PREPEND_NAMESPACE(endl)
doesn't seem to work, as that using
declaration brings std::endl
into the same top-level namespace.
The correct way to fix it is to simply not do that. Don't pollute the top level namespace until you've included every header you need.
Qt 5.15 moves that into the Qt
namespace and therefore fixes the problem, which is reflected in quazip_qt_compat.h
.
Moving an #include
line did indeed fix the problem. Thank you very much!
Using Qt 5.12.7 and QuaZip 1.1.
When building a package, I'm seeing this error:
Someone suggested me that line 142 should become
#define quazip_endl '\n' << Qt::flush
: what do you think?