How can I solve this bug in share-ptr signal slot ::-1: error: [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1
-
Re: Can't pass a signal with QSharedPointer (or std::shared_ptr<>) between threads
hi
the program is this:
#include <QCoreApplication>
#include <iostream>
#include <memory>
#include <QObject>
#include <QMetaType>class Student : public QObject
{
Q_OBJECTpublic:
void printOrder()
{
emit calledtoPrint();
}signals:
void calledtoPrint();
};
Q_DECLARE_METATYPE(Student)class Printer : public QObject
{
Q_OBJECT
//uncrustify off
public slots:
//uncrustify on
void print()
{
std::cout << " print the request" << std::endl;
}
};
Q_DECLARE_METATYPE(Printer)
int main(int argc, char* argv[])
{
QCoreApplication a(argc, argv);std::shared_ptr<Student> std = std::make_shared<Student>(); std::shared_ptr<Printer> print = std::make_shared<Printer>(); QObject::connect(std.get(), &Student::printOrder, print.get(), &Printer::print); std::cout << "Program start " << std::endl; std->printOrder(); return a.exec();}
-
Re: Can't pass a signal with QSharedPointer (or std::shared_ptr<>) between threads
hi
the program is this:
#include <QCoreApplication>
#include <iostream>
#include <memory>
#include <QObject>
#include <QMetaType>class Student : public QObject
{
Q_OBJECTpublic:
void printOrder()
{
emit calledtoPrint();
}signals:
void calledtoPrint();
};
Q_DECLARE_METATYPE(Student)class Printer : public QObject
{
Q_OBJECT
//uncrustify off
public slots:
//uncrustify on
void print()
{
std::cout << " print the request" << std::endl;
}
};
Q_DECLARE_METATYPE(Printer)
int main(int argc, char* argv[])
{
QCoreApplication a(argc, argv);std::shared_ptr<Student> std = std::make_shared<Student>(); std::shared_ptr<Printer> print = std::make_shared<Printer>(); QObject::connect(std.get(), &Student::printOrder, print.get(), &Printer::print); std::cout << "Program start " << std::endl; std->printOrder(); return a.exec();}
@nasimChildOfDesert Please post the actual error.
-
Re: Can't pass a signal with QSharedPointer (or std::shared_ptr<>) between threads
hi
the program is this:
#include <QCoreApplication>
#include <iostream>
#include <memory>
#include <QObject>
#include <QMetaType>class Student : public QObject
{
Q_OBJECTpublic:
void printOrder()
{
emit calledtoPrint();
}signals:
void calledtoPrint();
};
Q_DECLARE_METATYPE(Student)class Printer : public QObject
{
Q_OBJECT
//uncrustify off
public slots:
//uncrustify on
void print()
{
std::cout << " print the request" << std::endl;
}
};
Q_DECLARE_METATYPE(Printer)
int main(int argc, char* argv[])
{
QCoreApplication a(argc, argv);std::shared_ptr<Student> std = std::make_shared<Student>(); std::shared_ptr<Printer> print = std::make_shared<Printer>(); QObject::connect(std.get(), &Student::printOrder, print.get(), &Printer::print); std::cout << "Program start " << std::endl; std->printOrder(); return a.exec();}
it doesnt build and show this:
:-1: error: [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1 -
it doesnt build and show this:
:-1: error: [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1@nasimChildOfDesert This is not the actual error!
The actual error should be somewhere wbove that line. Please post it... -
it doesnt build and show this:
:-1: error: [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1@nasimChildOfDesert
iknow it is not specific error but i have this problem and share it . maybe someone help me.i cant build ,y cmake program in qt -
@nasimChildOfDesert
iknow it is not specific error but i have this problem and share it . maybe someone help me.i cant build ,y cmake program in qt@nasimChildOfDesert Why don't you simply post the error message?!
-
@nasimChildOfDesert Why don't you simply post the error message?!
@jsulm
you know , when i build my program it show this error .
i send all of the code.did you see that? -
@jsulm
you know , when i build my program it show this error .
i send all of the code.did you see that?@nasimChildOfDesert I will repeat this one more time: the actual error is above the line you posted! Can you please post the error? You can also post the whole build log.
This is not the error: :-1: error: [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1
It just tells you that there was an error. The error message must be ABOVE that line... -
@jsulm
you know , when i build my program it show this error .
i send all of the code.did you see that?@nasimChildOfDesert said in How can I solve this bug in share-ptr signal slot ::-1: error: [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1:
i send all of the code.did you see that?
I'm not asking for code, but for the error message...
-
@nasimChildOfDesert I will repeat this one more time: the actual error is above the line you posted! Can you please post the error? You can also post the whole build log.
This is not the error: :-1: error: [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1
It just tells you that there was an error. The error message must be ABOVE that line...@jsulm
im sorry : the compile out put is:
11:39:22: Running steps for project signalSlotsharePtr...
11:39:23: Starting: "/usr/bin/cmake" --build . --target clean
11:39:23: The process "/usr/bin/cmake" exited normally.
11:39:23: Starting: "/usr/bin/cmake" --build . --target all
[ 25%] Automatic MOC and UIC for target signalSlotsharePtrAutoMoc error
"SRC:/main.cpp"
contains a "Q_OBJECT" macro, but does not include "main.moc"!
Consider to- add #include "main.moc"
- enable SKIP_AUTOMOC for this file
make[2]: *** [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1
make[1]: *** [CMakeFiles/Makefile2:104: CMakeFiles/signalSlotsharePtr_autogen.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
11:39:23: The process "/usr/bin/cmake" exited with code 2.
Error while building/deploying project signalSlotsharePtr (kit: Desktop Qt 5.13.1 GCC 64bit)
When executing step "CMake Build"
11:39:23: Elapsed time: ۰:۰۰:۰۰. -
@jsulm
im sorry : the compile out put is:
11:39:22: Running steps for project signalSlotsharePtr...
11:39:23: Starting: "/usr/bin/cmake" --build . --target clean
11:39:23: The process "/usr/bin/cmake" exited normally.
11:39:23: Starting: "/usr/bin/cmake" --build . --target all
[ 25%] Automatic MOC and UIC for target signalSlotsharePtrAutoMoc error
"SRC:/main.cpp"
contains a "Q_OBJECT" macro, but does not include "main.moc"!
Consider to- add #include "main.moc"
- enable SKIP_AUTOMOC for this file
make[2]: *** [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1
make[1]: *** [CMakeFiles/Makefile2:104: CMakeFiles/signalSlotsharePtr_autogen.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
11:39:23: The process "/usr/bin/cmake" exited with code 2.
Error while building/deploying project signalSlotsharePtr (kit: Desktop Qt 5.13.1 GCC 64bit)
When executing step "CMake Build"
11:39:23: Elapsed time: ۰:۰۰:۰۰.@nasimChildOfDesert said in How can I solve this bug in share-ptr signal slot ::-1: error: [CMakeFiles/signalSlotsharePtr_autogen.dir/build.make:58: CMakeFiles/signalSlotsharePtr_autogen] Error 1:
contains a "Q_OBJECT" macro, but does not include "main.moc"!
This is the error and it also tells you what you should do to fix it:
Consider to add #include "main.moc" enable SKIP_AUTOMOC for this fileIt is better to define QObject based classes in their own header and cpp files.