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

error: ‘endl’ is not a member of ‘Qt’ and library dependencies #22

Closed
migraichen opened this issue Oct 18, 2020 · 8 comments
Closed

Comments

@migraichen
Copy link

compiling fails with the error " ‘endl’ is not a member of ‘Qt’ "
i can get over this by replacing all Qt::endl with "\n".

on Ubuntu 20.04.1 I had to manually add libilmbase12_2.2.0-11ubuntu2_amd64.deb and libopenexr22_2.2.0-10ubuntu2_amd64.deb to run the program.
Also after install the library libqarv-3.so.3 needs to be moved to a library-folder before starting the program.

@exzombie
Copy link
Member

Thanks for the report. I'll take a look soonish. I need to know a bit more, though: you say that you had to move the library. From where to where, exactly?

@migraichen
Copy link
Author

hey, i've copied it from the build folder to /usr/local/lib/x86_64-linux-gnu
since this is where aravis moves its library too.
But it probably depends on the distro.
"sudo /sbin/ldconfig -v" should give you the paths and libs that get looked up by the system.

@exzombie
Copy link
Member

Well, I've had mixed results.

I've used CMake-provided magic to get proper install paths. However, it will only work properly it you install to /usr by defining -DCMAKE_INSTALL_PREFIX=/usr. Installing to /usr/local, which is the default, will exhibit the same problem as before because CMake and Ubuntu disagree on what is the proper path in this case.

As for the Qt::endl issue, I'm not sure what I can do. The "bare" endl is deprecated since Qt 5.14 or 5.15 (not sure), and we're supposed to use fully-specified Qt::endl. But Ubuntu 20.04 comes with Qt 5.12, which doesn't have that. Using "\n" instead is not a good workaround because we'd need to add Qt::flush as well, and it has the same problem as Qt::endl.

@KlemenBlokar @alajovic @shrx Any ideas?

@migraichen
Copy link
Author

Hey, I agree that "\n" is more a quick hack than a solution. For that I'm probably going to update my QT and leave this as a note for other Ubuntu users.
The contradicting about using this on Ubuntu 20.04 is having to install libilmbase12 and libopenexr22 that come from Ubuntu 18.04 and got dropped in 20.04 but the QT version in Ubuntu 20.04 seems to be to old.

@exzombie
Copy link
Member

Interesting, I set up a fresh Ubuntu 20.04 container in order to test this, and did not need to install neither libilmbase12 nor libopenexr22. I'm sure this must be specific to your system; if I had to guess, I'd say you have some remnants somewhere that were left after a distribution upgrade. Or perhaps something that you installed manually sometime in the past.

@exzombie
Copy link
Member

Ah, to hell with it, let's just use the deprecated endl. I hate looking at warnings, but I guess working software has priority, right? ;)

@JanWielemaker
Copy link

Went for good old macros. After all I'm a C programmer rather than a C++ one 😄

#include <QtGlobal>

#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#define ENDL Qt::endl
#else
#define ENDL endl
#endif

@chryswoods
Copy link

Just found this issue (thanks!) and wanted to add that I solved this in a more C++ way ;-)

I also used this approach for QString::SkipEmptyParts

#include <QtGlobal>
#include <QString>

#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
namespace Qt
{
    static auto endl = ::endl;
    static auto SkipEmptyParts = QString::SkipEmptyParts;
}
#endif

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

4 participants