Moc_MyApp.cpp:94: multiple definition of `MyApp::ValueChanged(int) const' ---- first defined here MyApp.cpp
-
Hi,
I want to test the slots and signals, so I define a class include some signals and slots function.but I got some link error after I build the project.
So I don't know why in my moc_MyApp.cpp files include the all slots and signals function with the same name in MyApp.cpp ????
Below is my app.pro files
@
#-------------------------------------------------Project created by QtCreator 2010-10-25T17:56:41
#-------------------------------------------------
QT += core
QT -= gui
TARGET = MyApp_02
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = appSOURCES += main.cpp
MyApp.cppHEADERS +=
MyApp.h@
-
I can solved it if I remove the same name function from the moc_MyApp.cpp
But I want to know why moc_MyApp.cpp create the same name function??
-
to Franzk,
Thanks to your answer!
I see, I implements my signal and slot function in MyApp.cpp.But the same name signal and slot function created in moc_MyApp.cpp files when I compiler my projects.
So why? -
Signals should not be implemented at all.
-
To Denis,
I want to implement my signal function, so I must to implement it.
Could you tell me why should not be implemented? -
-
Signal is not a function in its common meaning. Think about it like some marker that does not have any logic, just only name. If you want to add some logic at signal emitting you can make one more slot and connect it to this signal.