PDA

View Full Version : QSerialDevice problem to start in GUi



ssaku
2nd December 2010, 16:59
Hi, my problem is to use the QSerialDevice in my Gui. Functions,constructors they are need QObject "parameters" but in my class in constructor I have QWidget



#include "src/qserialdeviceenumerator/serialdeviceenumerator.h"

canteen::canteen(QWidget *parent) :
QWidget(parent),
ui(new Ui::canteen)
{
this->m_sde= new SerialDeviceEnumerator(this);

ui->setupUi(this);

}
when i build ... is ":: error: collect2: ld returned 1 exit status"
And I have a few questons
1.Is it posible to use QSerialDevice in Gui ??
2. Can anybody could help ??
Sorry for my english

wysota
3rd December 2010, 01:12
Please post the first error you get instead of the last one.

ssaku
3rd December 2010, 08:41
It is something like this:

debug/canteen.o: In function `canteen':

C:\Qt\2010.05\Canteen/canteen.cpp:8: undefined reference to `SerialDeviceEnumerator::SerialDeviceEnumerator(QO bject*)'

C:\Qt\2010.05\Canteen/canteen.cpp:8: undefined reference to `SerialDeviceEnumerator::SerialDeviceEnumerator(QO bject*)'

collect2: ld returned 1 exit status

mingw32-make[1]: *** [debug/Canteen.exe] Error 1

mingw32-make: *** [debug] Error 2

Proces "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" zakończył się kodem wyjściowym %2.
BÅ‚Ä…d podczas budowania projektu Canteen (produkt docelowy: Desktop)
Podczas wykonywania kroku budowania "Make"

wysota
3rd December 2010, 09:57
Is the SerialDeviceEnumerator your class or is it part of QSerialDevice? If the latter, do you link with QSerialDevice?

ssaku
3rd December 2010, 12:31
Yes I use , include class from QSerialDevice. I copy the src something like this

#include "src/qserialdeviceenumerator/serialdeviceenumerator.h"
#include "src/qserialdevice/abstractserial.h"

wysota
3rd December 2010, 12:51
You are not copying the source, you only included header files.

ssaku
3rd December 2010, 13:02
The src is in the project file :) i copied them from the QSerialDevice project

wysota
3rd December 2010, 13:42
Does your project files reference all the cpp files? Because judging by the error they are not being compiled and linked with your project.

ssaku
6th December 2010, 09:33
Yes it is problem with including files. Because when I want run the application from BuldingExamples and chose in debug enumerator it ist working but when I want open just enumerator.pro and want run this I get something like

c:/qt/2010.05/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lqserialdeviced

collect2: ld returned 1 exit status

mingw32-make[1]: *** [debug/enumeratord.exe] Error 1

mingw32-make: *** [debug] Error 2

when i comment the line with -lqserialdevice in enumerator.pro I get the same error like in my project

wysota
6th December 2010, 09:51
Do you have the serial device library built?