Skip to content
Advertisement

Strange error while trying to deploy qt5 app on raspberry pi

I have a project which I’ve made on Ubuntu 14.04 LTS, but then, I wanted to test if the Raspberry Pi was capable of running this little program of mine. Then I’ve followed the instructions on this link to compile and build qt5 natively on the Pi.

I’ve managed to install qt5 without problems, I could even compile and run the “cube” program that is located on the qt samples.

After that, I’ve compiled and installed the qtmultimedia submodule, which I needed for my project.

Ok, things were looking good. Then I cloned my project on the Pi, ran qmake, and after that I ran make. Until… I got this error message:

JavaScript

Thing is… In this particular area of the code, I have no conversion from int to QString!

JavaScript

And here’s the Channel constructor:

JavaScript

And here is the command called by make:

JavaScript

So… Any thoughts? I have no idea of what is wrong. My code compiles on ubuntu and on Windows without this error message.

Advertisement

Answer

Your default argument for QString isn’t valid:

JavaScript

NULL is just a macro for 0, so you are effectively saying QString label = 0. QString doesn’t define a way to create a QString from an int, which is the reason for your error – on most platforms I’m guessing the QString(const char *) constructor would get called with an implicit conversion from 0 to const char *.

It looks like your pi had trouble figuring out how to implicitly convert that 0. Change it to QString label = "", QString label = QString(), or something similar.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement