Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » where and how to tell eclipse to add something to moc?(need to add something to makefile, so it can compile a program using qt5)
where and how to tell eclipse to add something to moc? [message #1850411] Wed, 02 March 2022 06:58 Go to next message
michael bridges is currently offline michael bridgesFriend
Messages: 9
Registered: September 2021
Junior Member
g++ -std=gnu++11 -std=c++11 -I/usr/include/qt4/ -I/usr/include/qt4/QtWidgets -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtSerialPort -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/CGUI.d" -MT"src/CGUI.o" -o "src/CGUI.o" "../src/CGUI.cpp"
../src/CGUI.cpp:9:10: fatal error: CGUI.moc: No such file or directory
    9 | #include "CGUI.moc"


i can find info on manualy making a makefile, but not where to add something to eclipse generated makefile.
Re: where and how to tell eclipse to add something to moc? [message #1850414 is a reply to message #1850411] Wed, 02 March 2022 08:36 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
Your source file CGUI.cpp needs a header file CGUI.moc which seems to be missing.

This is probably a Qt issue, off-topic for CDT directly.


--

Tauno Voipio
Re: where and how to tell eclipse to add something to moc? [message #1850435 is a reply to message #1850414] Thu, 03 March 2022 00:31 Go to previous messageGo to next message
michael bridges is currently offline michael bridgesFriend
Messages: 9
Registered: September 2021
Junior Member
off topic?
this is what came up, when i click new topic
Re: where and how to tell eclipse to add something to moc? [message #1850436 is a reply to message #1850414] Thu, 03 March 2022 00:45 Go to previous messageGo to next message
michael bridges is currently offline michael bridgesFriend
Messages: 9
Registered: September 2021
Junior Member
Tauno Voipio wrote on Wed, 02 March 2022 08:36
Your source file CGUI.cpp needs a header file CGUI.moc which seems to be missing.

yes, CGUI.moc is missing, which is what i am trying to find out how to get eclipse to run moc, when compiling
Re: where and how to tell eclipse to add something to moc? [message #1850437 is a reply to message #1850414] Thu, 03 March 2022 01:15 Go to previous messageGo to next message
michael bridges is currently offline michael bridgesFriend
Messages: 9
Registered: September 2021
Junior Member
Tauno Voipio wrote on Wed, 02 March 2022 08:36
Your source file CGUI.cpp needs a header file CGUI.moc which seems to be missing.


according to: https://doc.qt.io/qt-5/moc.html#writing-make-rules-for-invoking
"For anything but the simplest test programs, it is recommended that you automate running the moc. By adding some rules to your program's makefile, make can take care of running moc when necessary and handling the moc output."

eclipse auto-generates a makefile with each compile.

every time CGUI.cpp, CGUI.moc will change
Re: where and how to tell eclipse to add something to moc? [message #1850448 is a reply to message #1850437] Thu, 03 March 2022 11:28 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
gcc couldn't find it. So it either doesn't exist or you neglected to
tell gcc the directory containing it (with -I <whatever>).

If it must be generated by a special tool
then you will need to write your own makefile
unless you can execute it as a prebuild step
which will cause a rebuild every time.

Eclipse/CDT didn't cause this.
Yes, it's off-topic.
This forum I'd for addressing issues with CDT itself
and not for fixing project related problems.

[Updated on: Thu, 03 March 2022 11:39]

Report message to a moderator

Previous Topic:building C/C++ hello world
Next Topic:Compiling C and C++ code in the same project
Goto Forum:
  


Current Time: Fri Apr 19 21:28:07 GMT 2024

Powered by FUDForum. Page generated in 0.02732 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top