hi, im having a strange problem when trying to emit a signal from a thread.

thread.h:

Qt Code:
  1. #ifndef USBCOM_H
  2. #define USBCOM_H
  3.  
  4. #include <QObject>
  5. #include <QThread>
  6.  
  7. class UsbCom : public QThread
  8. {
  9. public:
  10. UsbCom();
  11. void run();
  12.  
  13. signals:
  14. void error(QString error);
  15. };
  16.  
  17. #endif // USBCOM_H
To copy to clipboard, switch view to plain text mode 

thread.cpp:

Qt Code:
  1. #include "usbcom.h"
  2. #include <QtGui>
  3.  
  4. UsbCom::UsbCom()
  5. {
  6. }
  7.  
  8. void UsbCom::run()
  9. {
  10. emit error("error!");
  11. }
To copy to clipboard, switch view to plain text mode 

now when trying to compile this program i am getting an undefined refference error from the compiler.

Qt Code:
  1. Running build steps for project Project...
  2. Configuration unchanged, skipping QMake step.
  3. Starting: /usr/bin/make -w
  4. make: Entering directory `/home/sisco/Documents/School/Project 3/Project Software/Project'
  5. g++ -c -m64 -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/home/sisco/qtsdk-2009.04/qt/mkspecs/linux-g++-64 -I. -I/home/sisco/qtsdk-2009.04/qt/include/QtCore -I/home/sisco/qtsdk-2009.04/qt/include/QtGui -I/home/sisco/qtsdk-2009.04/qt/include -I../../src -I../../src -Imoc -I. -o obj/project.o project.cpp
  6. g++ -c -m64 -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/home/sisco/qtsdk-2009.04/qt/mkspecs/linux-g++-64 -I. -I/home/sisco/qtsdk-2009.04/qt/include/QtCore -I/home/sisco/qtsdk-2009.04/qt/include/QtGui -I/home/sisco/qtsdk-2009.04/qt/include -I../../src -I../../src -Imoc -I. -o obj/usbcom.o usbcom.cpp
  7. g++ -m64 -Wl,-rpath,/home/sisco/qtsdk-2009.04/qt/lib -o ../../examples/bin/Project obj/main.o obj/project.o obj/savedialog.o obj/overwritedialog.o obj/tables.o obj/usbcom.o obj/moc_project.o obj/moc_savedialog.o obj/moc_overwritedialog.o obj/moc_tables.o obj/qrc_icons.o -L/home/sisco/qtsdk-2009.04/qt/lib -L../../lib -lqwt -lusb-1.0 -lQtGui -L/home/sisco/qtsdk-2009.04/qt/lib -L/usr/X11R6/lib64 -pthread -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
  8. obj/usbcom.o: In function `UsbCom::run()':
  9. /home/sisco/Documents/School/Project 3/Project Software/Project/usbcom.cpp:10: undefined reference to `UsbCom::error(QString)'
  10. collect2: ld returned 1 exit status
  11. make: Leaving directory `/home/sisco/Documents/School/Project 3/Project Software/Project'
  12. make: *** [../../examples/bin/Project] Error 1
  13. Exited with code 2.
  14. Error while building project Project
  15. When executing build step 'Make'
To copy to clipboard, switch view to plain text mode 

code used in my main class:

Qt Code:
  1. usbcom = new UsbCom();
  2. connect(usbcom, SIGNAL(error(QString)), SLOT(usbError(QString)));
  3. usbcom->start();
To copy to clipboard, switch view to plain text mode 

what am i doing wrong?