Build fails: "QCameraInfo: No such file or directory" after clean install on Windows and Docker
-
Hello,
I am having a persistent build error and I am out of ideas. I cannot compile a simple project that uses Qt Multimedia.
The Error:
My project fails with the error:fatal error: QCameraInfo: No such file or directory
when I try to#include <QCameraInfo>
.Environments:
I have tried this on two completely different clean systems, and the error is the same on both:- Windows 11: Qt 6.9.1, Qt Creator 17.0.0, using MSVC 2019 64-bit compiler.
- Linux: Fresh
ubuntu:22.04
Docker container, Qt 6.x.x, using GCC.
What I have tried (Summary):
I have spent a very long time troubleshooting this. Here is what I have already done on BOTH systems:- Confirmed my
.pro
file containsQT += multimedia
. - Used the official Qt Online Installer to do a complete, clean installation of Qt.
- During installation, I carefully selected the components:
Desktop
(for my compiler, e.g., MSVC or GCC) andAdditional Libraries > Qt Multimedia
. I have double-checked this selection. - Completely deleted all Qt folders (
C:\Qt
,~/Qt
, config files in%APPDATA%
, etc.) before reinstalling. - The key evidence: After a fresh install finishes, I searched for the header file. On Linux,
find ~/Qt -name "QCameraInfo.h"
returns nothing. This proves the file is physically not being installed.
My Question:
Why would the official Qt Online Installer fail to install the Qt Multimedia files on two different clean systems (Windows and Ubuntu Docker)? It seems the installer is completing without errors, but the files are missing.Is this a known issue? Is there anything else I can check?
Thank you for any help.
-
QCameraInfo ist not available in Qt6 as you can see e.g. here: https://doc.qt.io/qt-6/qtmultimedia-modules.html, I would guess it's https://doc.qt.io/qt-6/qcameradevice.html now
-
Thank you for your reply. Your suggestion was the key to solving a problem I had been struggling with for a very long time.
You were completely correct. The root cause was a Qt 5 vs. Qt 6 API change. I was trying to use the obsolete
QCameraInfo
class in my Qt 6 project.As soon as I refactored my code to use
QMediaDevices::videoInputs()
and theQCameraDevice
class, the "file not found" error was resolved. I had spent many hours trying to fix what I thought was a broken installation, so your insight was incredibly helpful.Thank you for sharing your knowledge!