Saturday 30 July 2011

error while running tests :2


[  3%] Built target Alkinvoice
[  7%] Built target Alkpayee
[ 11%] Built target Alkpayment
[ 14%] Built target Alkuser
[ 14%] Built target alkinvoicetest_automoc
Scanning dependencies of target alkinvoicetest
[ 18%] Building CXX object backend/CMakeFiles/alkinvoicetest.dir/alkinvoicetest.o
Linking CXX executable alkinvoicetest
CMakeFiles/alkinvoicetest.dir/alkinvoicetest.o: In function `main':
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:25: undefined reference to `QApplication::QApplication(int&, char**, int)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:25: undefined reference to `QApplication::~QApplication()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:25: undefined reference to `QApplication::~QApplication()'
../lib/libAlkinvoice.a(alkinvoice.o): In function `AlkInvoice':
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoice.cpp:57: undefined reference to `vtable for AlkInvoice'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoice.cpp:57: undefined reference to `vtable for AlkInvoice'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoice.cpp:45: undefined reference to `vtable for AlkInvoice'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoice.cpp:45: undefined reference to `vtable for AlkInvoice'
../lib/libAlkinvoice.a(alkinvoice.o): In function `~AlkInvoice':
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoice.cpp:50: undefined reference to `vtable for AlkInvoice'
../lib/libAlkinvoice.a(alkinvoice.o):/home/puneet/puneet/office/alkimia/payment/backend/alkinvoice.cpp:50: more undefined references to `vtable for AlkInvoice' follow
collect2: ld returned 1 exit status
make[2]: *** [backend/alkinvoicetest] Error 1
make[1]: *** [backend/CMakeFiles/alkinvoicetest.dir/all] Error 2
make: *** [all] Error 2


SOLUTION


I solved it the error with QApplication by linking the QT_LIBRARIES with the test files with the following code





target_link_libraries( alkusertest Alkuser alkimia ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_LIBRARIES} )
target_link_libraries( alkinvoicetest Alkinvoice alkimia ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_LIBRARIES} )
target_link_libraries( alkpaymenttest Alkpayment alkimia ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_LIBRARIES} )

No comments:

Post a Comment