223 questions
2
votes
0
answers
65
views
Qt's MOC can not find headers under include/projname [duplicate]
This question is not a duplicate of undefined reference to `vtable for MainWindow'. As I have mentioned in the following I know how to solve the compile error but my question is how to solve the ...
0
votes
2
answers
135
views
Visual Studio 2022 generate empty moc files with define
My QtExample.h with Q_OBJECT has an #ifdef _FEATURE. The #ifdef wraps the class. In Project -> C++ -> Preprocessor -> Preprocessor Definitions, this _FEATURE is specified. When moc.exe runs ...
0
votes
0
answers
117
views
error: no match for 'operator!=' (operand types are 'QVector<Object>' {aka 'QList<Object>'} and 'QList<Object>')
I have Qt code that looks like following:
class test_gadget {
Q_GADGET
Q_PROPERTY(QString test MEMBER test)
public:
QString test;
};
class test_gadget2 {
Q_GADGET
Q_PROPERTY(...
0
votes
1
answer
99
views
How to tell gcc that my source contains Q_OBJECT?
I am trying to compile an object file, for C++/Qt; but I receive the warning below, stating that there is no "Q_OBJECT" in my code.
Do I miss something? (my CMakeList.txt contains set(...
0
votes
0
answers
455
views
Qt/C++: 'undefined reference to __imp__ZN5Enemy16staticMetaObjectE' when building project on Windows with MinGW
It is my first post here so please ask for any extra info you need!
I have to make this game in Qt with a given source code to start from: world.h & world.cpp
Given code class example:
Now when I ...
0
votes
0
answers
59
views
C++ QT - moc_class.o Problem with connecting signal and slot for QLabel in QGridLayout
I am trying to program a code, which projects a QGridLayout with several QLabels, which contain pictures. When clicking on a QLabel, I want to call a function and "do stuff". Unfortunately I ...
0
votes
0
answers
82
views
undefined refderence to vtable with Qt library using Q_OBJECT
After some research I found a solution for this error that has happened to a fiew fellow programmers:
#include <QtCharts/QChartView>
class A {
class MyQObject: public QtCharts::QChartView {
...
0
votes
1
answer
813
views
CMake AUTOMOC vs. qt5_wrap_cpp
I would wish to use qt5_wrap_cpp (much faster) than CMake's AUTOMOC feature, but I have a problem. In one of the libraries (other compile fine) some of generated moc files with qt5_wrap_cpp are ...
0
votes
1
answer
525
views
QtProject meta object compiler goes haywire
Im trying to add a graphical UI for my dungeon crawler game for an university assignment.
It's my first time using Qt (and first time asking a question here so sorry if it's incoherent, i'll gladly ...
0
votes
1
answer
346
views
Should we prefer Qt's private slots over public slots?
Qt "private slots:" what is this?
AFAIK @Andrew's answer to the question above addresses the point. And @borges mentions the important detail
When the method is called via signal/slot ...
1
vote
0
answers
172
views
Can Qt's `moc` and/or `uic` be made to treat warnings as errors?
As we've worked to move more and more of our codebase to a warnings-as-errors model, one thing I've noticed is that warnings spit out by uic and moc still slip through uncaught. Things like:
foo.ui: ...
1
vote
1
answer
111
views
Why the "%.moc" does not work in my Makefile?
I have the following Makefile:
CC=g++ -std=c++17
MYCXXFLAGS=-Werror -Wall
clean:
rm -f *.o main
a.moc:
@echo "mocing $@"
%.o: %.cpp %.moc
@echo "all prerequisites $^&...
-2
votes
2
answers
218
views
Qt class MyButton when use Q_PRIVATE_SLOT, the .h file compile error: undefined MyButtonPrivate
https://www.dvratil.cz/2019/11/q-private-slot-with-new-connect-syntax/
#include <QPushButton>
#include <memory>
class MyButtonPrivate;
class MyButton : public QPushButton {
Q_OBJECT
...
7
votes
1
answer
2k
views
qt moc error:usr/include/c++/10/bits/fs_fwd.:39: Parse error at "std"
my configuration is:
ubuntu 21.04
gcc 11
qt 5.15.2
and error message like this:
AutoMoc subprocess error
------------------------
The moc process failed to compile
"SRC:/src/Layers/ViewLayer/...
1
vote
1
answer
787
views
Qt, MSVC, Suppress compiler warning in a moc_
I've just started using MSVC with Qt. While compiling a moc_, MSCV is generating
a warning -
"warning C4251: 'QBasicMutex::d_ptr': class 'QBasicAtomicPointer' needs to have dll-interface to be ...
0
votes
0
answers
55
views
Send client member-function to SLOT() macro
I've currently studied QT and have to face the problem of passing member function pointer to SLOT macro. Here is the part of code:
main.cpp:
#include <iostream>
#include <QApplication>
#...
1
vote
0
answers
659
views
Moving from QT 5.12.8 to 5.15.2 MOC fails
We try to mov to the latest Qt 5 LTSB (5.15.2) from our working base Qt 5.12.8 but ran into MOC errors:
The moc process failed to compile
"SRC:GenericForm.h"
into
"SRC:...
1
vote
1
answer
1k
views
Qt error involving moc files not fixed by cleaning project
What is the code
I am trying to learn Qt c++ with the book learn Qt 5. This is the follow along code. The particular section that is giving the error is for writing a preset welcome message. The Qml ...
0
votes
1
answer
433
views
How to create a custom suffix rule to use a header in another directory?
I have a Makefile.am like the following to compile MOC files for Qt using automake.
bin_PROGRAMS = test
test_qtheaders = window.h
test_moc_sources = $(test_qtheaders:.h=_moc.cpp)
test_SOURCES = ...
0
votes
1
answer
373
views
Qt undefined reference vtable
I made simple game to shot rectangle(class Bullet) from other rectangle(class MyRect). I have error undefined reference to 'vtable for bullet'. I have written that is connected with Q_OBJECT and moc.I ...
2
votes
1
answer
2k
views
Should I use #ifndef Q_MOC_RUN as much a possible?
I have a Qt/C++ project that uses Boost library, and I see Boost headers are included like this:
#ifndef Q_MOC_RUN
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/...
0
votes
1
answer
586
views
Generate moc file for header only class outside the project tree
I have some classes defined only using a headers file that inherits the QObject class and uses the Q_OBJECT macro. They are placed in a certain folder on my PC.
I want to include these classes in my ...
0
votes
1
answer
390
views
Error when building Qt app in a recent Docker
I am building a Qt c++ app in a Docker on Travis.
I am trying to update the base Docker image from Cosmic to Disco.
I did these updates:
Travis dist: Trusty => Xenial
Docker image: Cosmic => Disco
...
1
vote
1
answer
349
views
How to manually repc Qt .rep to .h and then moc them to .cpp
I'm trying to manually calling repc on my .rep files then running moc on the header output files.
repc runs successfully, but moc randomly complains about a
parse error at '('
after a Q_CLASSINFO ...
2
votes
1
answer
2k
views
Why is cmake not mocing my Q_OBJECT headers?
I currently have a project set up like this:
- project/
--- include/
--- src/
--- qml/
--- CMakeLists.txt
--- qml.qrc
And a CMakeLists.txt like this:
cmake_minimum_required(VERSION 3.1)
...