Tuesday, 13 December 2011

Nautilus Cannot Handle “Computer” Location On Ubuntu


The error says :
Nautilus cannot handle "computer" location
I found out that i have upgraded my glib library under /usr/local few days ago.
Solution:
Remove /usr/local
sudo mv /usr/local /usr/local.old
create /usr/local
sudo mkdir /usr/local
restart your computer.
Try to check you computer folder and its working! Good luck!

Monday, 12 December 2011

Wednesday, 2 November 2011

Calculate Lines of code of your project

Recently I got to know about this KLOC using which we can calculate the lines of code of our project. you just need to enter the path of your project and run this php file and it will automatically give you the no. of files of each and every type

check http://pastebin.com/gQiM9Yu3 for its php code

Friday, 28 October 2011

Building digikam

this can be easily done by typing the following simple command in your terminal window

sudo apt-get install build-essential kdelibs5-dev kdepimlibs5-dev libboost-dev libcv-dev libcvaux-dev libexpat1-dev libglib2.0-dev libgphoto2-2-dev libhighgui-dev libjasper-dev libkipi-dev liblcms1-dev liblensfun-dev liblqr-1-0-dev libmarble-dev libqca2-dev libtiff4-dev libxml2-dev libxslt1-dev zlib1g-dev libboost-graph-dev opencv-doc
sudo apt-get build-dep digikam
sudo apt-get build-dep kipi-plugins


digikam

now i am starting up with a new project named "digikam"
what i have to do is "Port digiKam camera icon-view to Qt4 model/view"
or you can say that i am solving the bug https://bugs.kde.org/show_bug.cgi?id=279953

Tuesday, 2 August 2011

output while running payment usecase with tests


puneet@puneet-Studio-1458:~/puneet/office/alkimia/payment/build$ cmake -DKDE4_BUILD_TESTS=on ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXau.so;/usr/lib/libXdmcp.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXau.so;/usr/lib/libXdmcp.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib/libX11.so
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- Found Automoc4: /usr/bin/automoc4
-- Found Perl: /usr/bin/perl
-- Found Phonon: /usr/include
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Failed
-- Performing Test HAVE_FPIE_SUPPORT
-- Performing Test HAVE_FPIE_SUPPORT - Success
-- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL
-- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL - Success
-- Performing Test __KDE_HAVE_GCC_VISIBILITY
-- Performing Test __KDE_HAVE_GCC_VISIBILITY - Success
-- Found KDE 4.5 include dir: /usr/include
-- Found KDE 4.5 library dir: /usr/lib
-- Found the KDE4 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
-- Found automoc4: /usr/bin/automoc4
-- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
-- Found X11: /usr/lib/libX11.so
-- Found GMP: /usr/include
-- checking for module 'libalkimia'
--   found libalkimia, version 4
-- Found LibAlkimia: /usr/lib/libalkimia.so
-- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
-- Found X11: /usr/lib/libX11.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/puneet/puneet/office/alkimia/payment/build
puneet@puneet-Studio-1458:~/puneet/office/alkimia/payment/build$ make
[  1%] Generating moc_payment.cxx
[  2%] Generating moc_backend.cxx
[  3%] Generating moc_storageusermanager.cxx
[  4%] Generating moc_usermanager.cxx
[  4%] Generating moc_keyusermanager.cxx
[  5%] Generating moc_alkuser.cxx
[  6%] Generating moc_alkinvoice.cxx
[  7%] Generating moc_alkpayment.cxx
[  8%] Generating moc_alkpayee.cxx
Scanning dependencies of target Alkinvoice
[  8%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/alkinvoice.o
[  9%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/moc_backend.o
[ 10%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/moc_storageusermanager.o
[ 11%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/moc_usermanager.o
[ 12%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/moc_keyusermanager.o
[ 13%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/moc_alkuser.o
[ 13%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/moc_alkinvoice.o
[ 14%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/moc_alkpayment.o
[ 15%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/moc_alkpayee.o
[ 16%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/moc_payment.o
Linking CXX static library ../lib/libAlkinvoice.a
[ 16%] Built target Alkinvoice
Scanning dependencies of target Alkpayee
[ 17%] Building CXX object backend/CMakeFiles/Alkpayee.dir/alkpayee.o
[ 17%] Building CXX object backend/CMakeFiles/Alkpayee.dir/moc_backend.o
[ 18%] Building CXX object backend/CMakeFiles/Alkpayee.dir/moc_storageusermanager.o
[ 19%] Building CXX object backend/CMakeFiles/Alkpayee.dir/moc_usermanager.o
[ 20%] Building CXX object backend/CMakeFiles/Alkpayee.dir/moc_keyusermanager.o
[ 21%] Building CXX object backend/CMakeFiles/Alkpayee.dir/moc_alkuser.o
[ 22%] Building CXX object backend/CMakeFiles/Alkpayee.dir/moc_alkinvoice.o
[ 23%] Building CXX object backend/CMakeFiles/Alkpayee.dir/moc_alkpayment.o
[ 23%] Building CXX object backend/CMakeFiles/Alkpayee.dir/moc_alkpayee.o
[ 24%] Building CXX object backend/CMakeFiles/Alkpayee.dir/moc_payment.o
Linking CXX static library ../lib/libAlkpayee.a
[ 32%] Built target Alkpayee
Scanning dependencies of target Alkpayment
[ 33%] Building CXX object backend/CMakeFiles/Alkpayment.dir/alkpayment.o
[ 34%] Building CXX object backend/CMakeFiles/Alkpayment.dir/moc_backend.o
[ 35%] Building CXX object backend/CMakeFiles/Alkpayment.dir/moc_storageusermanager.o
[ 35%] Building CXX object backend/CMakeFiles/Alkpayment.dir/moc_usermanager.o
[ 36%] Building CXX object backend/CMakeFiles/Alkpayment.dir/moc_keyusermanager.o
[ 37%] Building CXX object backend/CMakeFiles/Alkpayment.dir/moc_alkuser.o
[ 38%] Building CXX object backend/CMakeFiles/Alkpayment.dir/moc_alkinvoice.o
[ 39%] Building CXX object backend/CMakeFiles/Alkpayment.dir/moc_alkpayment.o
[ 40%] Building CXX object backend/CMakeFiles/Alkpayment.dir/moc_alkpayee.o
[ 41%] Building CXX object backend/CMakeFiles/Alkpayment.dir/moc_payment.o
Linking CXX static library ../lib/libAlkpayment.a
[ 48%] Built target Alkpayment
Scanning dependencies of target Alkuser
[ 49%] Building CXX object backend/CMakeFiles/Alkuser.dir/alkuser.o
[ 50%] Building CXX object backend/CMakeFiles/Alkuser.dir/moc_backend.o
[ 51%] Building CXX object backend/CMakeFiles/Alkuser.dir/moc_storageusermanager.o
[ 52%] Building CXX object backend/CMakeFiles/Alkuser.dir/moc_usermanager.o
[ 52%] Building CXX object backend/CMakeFiles/Alkuser.dir/moc_keyusermanager.o
[ 53%] Building CXX object backend/CMakeFiles/Alkuser.dir/moc_alkuser.o
[ 54%] Building CXX object backend/CMakeFiles/Alkuser.dir/moc_alkinvoice.o
[ 55%] Building CXX object backend/CMakeFiles/Alkuser.dir/moc_alkpayment.o
[ 56%] Building CXX object backend/CMakeFiles/Alkuser.dir/moc_alkpayee.o
[ 57%] Building CXX object backend/CMakeFiles/Alkuser.dir/moc_payment.o
Linking CXX static library ../lib/libAlkuser.a
[ 64%] Built target Alkuser
Scanning dependencies of target alkinvoicetest_automoc
Generating moc_alkinvoicetest.cpp
[ 64%] Built target alkinvoicetest_automoc
Scanning dependencies of target alkinvoicetest
[ 65%] Building CXX object backend/CMakeFiles/alkinvoicetest.dir/alkinvoicetest_automoc.o
[ 66%] Building CXX object backend/CMakeFiles/alkinvoicetest.dir/alkinvoicetest.o
Linking CXX executable alkinvoicetest
[ 66%] Built target alkinvoicetest
Scanning dependencies of target alkpaymenttest_automoc
Generating moc_alkpaymenttest.cpp
[ 66%] Built target alkpaymenttest_automoc
Scanning dependencies of target alkpaymenttest
[ 67%] Building CXX object backend/CMakeFiles/alkpaymenttest.dir/alkpaymenttest_automoc.o
[ 68%] Building CXX object backend/CMakeFiles/alkpaymenttest.dir/alkpaymenttest.o
Linking CXX executable alkpaymenttest
[ 68%] Built target alkpaymenttest
Scanning dependencies of target alkusertest_automoc
Generating moc_alkusertest.cpp
[ 68%] Built target alkusertest_automoc
Scanning dependencies of target alkusertest
[ 69%] Building CXX object backend/CMakeFiles/alkusertest.dir/alkusertest_automoc.o
[ 70%] Building CXX object backend/CMakeFiles/alkusertest.dir/alkusertest.o
Linking CXX executable alkusertest
[ 70%] Built target alkusertest
Scanning dependencies of target paymentbackend_automoc
Generating moc_alkpayment.cpp
Generating moc_alkpayee.cpp
Generating moc_alkuser.cpp
Generating moc_usermanager.cpp
Generating moc_alkinvoice.cpp
Generating moc_keyusermanager.cpp
Generating moc_storageusermanager.cpp
Generating moc_payment.cpp
Generating moc_backend.cpp
[ 70%] Built target paymentbackend_automoc
[ 71%] Generating usermanageradaptor.cpp, usermanageradaptor.h
[ 72%] Generating usermanageradaptor.moc
[ 73%] Generating keyusermanageradaptor.cpp, keyusermanageradaptor.h
[ 74%] Generating keyusermanageradaptor.moc
Scanning dependencies of target paymentbackend
[ 74%] Building CXX object backend/CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o
[ 75%] Building CXX object backend/CMakeFiles/paymentbackend.dir/main.o
[ 76%] Building CXX object backend/CMakeFiles/paymentbackend.dir/backend.o
[ 77%] Building CXX object backend/CMakeFiles/paymentbackend.dir/storageusermanager.o
/home/puneet/puneet/office/alkimia/payment/backend/storageusermanager.cpp:33: warning: unused parameter ‘parent’
[ 78%] Building CXX object backend/CMakeFiles/paymentbackend.dir/usermanager.o
/home/puneet/puneet/office/alkimia/payment/backend/usermanager.cpp:171: warning: unused parameter ‘user’
[ 79%] Building CXX object backend/CMakeFiles/paymentbackend.dir/keyusermanager.o
[ 80%] Building CXX object backend/CMakeFiles/paymentbackend.dir/alkuser.o
[ 80%] Building CXX object backend/CMakeFiles/paymentbackend.dir/alkinvoice.o
[ 81%] Building CXX object backend/CMakeFiles/paymentbackend.dir/alkpayment.o
[ 82%] Building CXX object backend/CMakeFiles/paymentbackend.dir/alkpayee.o
[ 83%] Building CXX object backend/CMakeFiles/paymentbackend.dir/payment.o
[ 84%] Building CXX object backend/CMakeFiles/paymentbackend.dir/usermanageradaptor.o
[ 85%] Building CXX object backend/CMakeFiles/paymentbackend.dir/keyusermanageradaptor.o
[ 86%] Building CXX object backend/CMakeFiles/paymentbackend.dir/moc_backend.o
[ 86%] Building CXX object backend/CMakeFiles/paymentbackend.dir/moc_storageusermanager.o
[ 87%] Building CXX object backend/CMakeFiles/paymentbackend.dir/moc_usermanager.o
[ 88%] Building CXX object backend/CMakeFiles/paymentbackend.dir/moc_keyusermanager.o
[ 89%] Building CXX object backend/CMakeFiles/paymentbackend.dir/moc_alkuser.o
[ 90%] Building CXX object backend/CMakeFiles/paymentbackend.dir/moc_alkinvoice.o
[ 91%] Building CXX object backend/CMakeFiles/paymentbackend.dir/moc_alkpayment.o
[ 92%] Building CXX object backend/CMakeFiles/paymentbackend.dir/moc_alkpayee.o
[ 92%] Building CXX object backend/CMakeFiles/paymentbackend.dir/moc_payment.o
Linking CXX executable paymentbackend
CMakeFiles/paymentbackend.dir/moc_backend.o: In function `Backend::metaObject() const':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_backend.cxx:56: multiple definition of `Backend::metaObject() const'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_backend.cpp:56: first defined here
CMakeFiles/paymentbackend.dir/moc_backend.o:(.rodata+0x0): multiple definition of `Backend::staticMetaObject'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:(.rodata+0xc0): first defined here
CMakeFiles/paymentbackend.dir/moc_backend.o: In function `Backend::qt_metacall(QMetaObject::Call, int, void**)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_backend.cxx:69: multiple definition of `Backend::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_backend.cpp:69: first defined here
CMakeFiles/paymentbackend.dir/moc_backend.o: In function `Backend::qt_metacast(char const*)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_backend.cxx:61: multiple definition of `Backend::qt_metacast(char const*)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_backend.cpp:61: first defined here
CMakeFiles/paymentbackend.dir/moc_storageusermanager.o: In function `StorageUserManager::metaObject() const':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_storageusermanager.cxx:50: multiple definition of `StorageUserManager::metaObject() const'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_storageusermanager.cpp:50: first defined here
CMakeFiles/paymentbackend.dir/moc_storageusermanager.o:(.rodata+0x0): multiple definition of `StorageUserManager::staticMetaObject'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:(.rodata+0xa0): first defined here
CMakeFiles/paymentbackend.dir/moc_storageusermanager.o: In function `StorageUserManager::qt_metacall(QMetaObject::Call, int, void**)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_storageusermanager.cxx:63: multiple definition of `StorageUserManager::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_storageusermanager.cpp:63: first defined here
CMakeFiles/paymentbackend.dir/moc_storageusermanager.o: In function `StorageUserManager::qt_metacast(char const*)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_storageusermanager.cxx:55: multiple definition of `StorageUserManager::qt_metacast(char const*)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_storageusermanager.cpp:55: first defined here
CMakeFiles/paymentbackend.dir/moc_usermanager.o: In function `UserManager::metaObject() const':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cxx:73: multiple definition of `UserManager::metaObject() const'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cpp:73: first defined here
CMakeFiles/paymentbackend.dir/moc_usermanager.o:(.rodata+0x28): multiple definition of `UserManager::staticMetaObject'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:(.rodata+0x70): first defined here
CMakeFiles/paymentbackend.dir/moc_usermanager.o: In function `UserManager::newUsersAdded(QStringList const&, bool)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cxx:126: multiple definition of `UserManager::newUsersAdded(QStringList const&, bool)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cpp:126: first defined here
CMakeFiles/paymentbackend.dir/moc_usermanager.o: In function `UserManager::userDeleted(QString const&)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cxx:119: multiple definition of `UserManager::userDeleted(QString const&)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cpp:119: first defined here
CMakeFiles/paymentbackend.dir/moc_usermanager.o: In function `UserManager::userInitialized(QString const&)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cxx:112: multiple definition of `UserManager::userInitialized(QString const&)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cpp:112: first defined here
CMakeFiles/paymentbackend.dir/moc_usermanager.o: In function `UserManager::qt_metacall(QMetaObject::Call, int, void**)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cxx:86: multiple definition of `UserManager::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cpp:86: first defined here
CMakeFiles/paymentbackend.dir/moc_usermanager.o: In function `UserManager::qt_metacast(char const*)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cxx:78: multiple definition of `UserManager::qt_metacast(char const*)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_usermanager.cpp:78: first defined here
CMakeFiles/paymentbackend.dir/moc_keyusermanager.o: In function `KeyUserManager::metaObject() const':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_keyusermanager.cxx:65: multiple definition of `KeyUserManager::metaObject() const'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_keyusermanager.cpp:65: first defined here
CMakeFiles/paymentbackend.dir/moc_keyusermanager.o:(.rodata+0x18): multiple definition of `KeyUserManager::staticMetaObject'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:(.rodata+0x90): first defined here
CMakeFiles/paymentbackend.dir/moc_keyusermanager.o: In function `KeyUserManager::userInitialized(QString const&)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_keyusermanager.cxx:103: multiple definition of `KeyUserManager::userInitialized(QString const&)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_keyusermanager.cpp:103: first defined here
CMakeFiles/paymentbackend.dir/moc_keyusermanager.o: In function `KeyUserManager::qt_metacall(QMetaObject::Call, int, void**)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_keyusermanager.cxx:78: multiple definition of `KeyUserManager::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_keyusermanager.cpp:78: first defined here
CMakeFiles/paymentbackend.dir/moc_keyusermanager.o: In function `KeyUserManager::qt_metacast(char const*)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_keyusermanager.cxx:70: multiple definition of `KeyUserManager::qt_metacast(char const*)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_keyusermanager.cpp:70: first defined here
CMakeFiles/paymentbackend.dir/moc_alkuser.o: In function `AlkUser::metaObject() const':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkuser.cxx:50: multiple definition of `AlkUser::metaObject() const'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkuser.cpp:50: first defined here
CMakeFiles/paymentbackend.dir/moc_alkuser.o:(.rodata+0x0): multiple definition of `AlkUser::staticMetaObject'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:(.rodata+0x60): first defined here
CMakeFiles/paymentbackend.dir/moc_alkuser.o: In function `AlkUser::qt_metacall(QMetaObject::Call, int, void**)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkuser.cxx:63: multiple definition of `AlkUser::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkuser.cpp:63: first defined here
CMakeFiles/paymentbackend.dir/moc_alkuser.o: In function `AlkUser::qt_metacast(char const*)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkuser.cxx:55: multiple definition of `AlkUser::qt_metacast(char const*)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkuser.cpp:55: first defined here
CMakeFiles/paymentbackend.dir/moc_alkinvoice.o: In function `AlkInvoice::metaObject() const':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkinvoice.cxx:50: multiple definition of `AlkInvoice::metaObject() const'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkinvoice.cpp:50: first defined here
CMakeFiles/paymentbackend.dir/moc_alkinvoice.o:(.rodata+0x0): multiple definition of `AlkInvoice::staticMetaObject'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:(.rodata+0x80): first defined here
CMakeFiles/paymentbackend.dir/moc_alkinvoice.o: In function `AlkInvoice::qt_metacall(QMetaObject::Call, int, void**)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkinvoice.cxx:63: multiple definition of `AlkInvoice::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkinvoice.cpp:63: first defined here
CMakeFiles/paymentbackend.dir/moc_alkinvoice.o: In function `AlkInvoice::qt_metacast(char const*)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkinvoice.cxx:55: multiple definition of `AlkInvoice::qt_metacast(char const*)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkinvoice.cpp:55: first defined here
CMakeFiles/paymentbackend.dir/moc_alkpayment.o: In function `AlkPayment::metaObject() const':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayment.cxx:50: multiple definition of `AlkPayment::metaObject() const'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayment.cpp:50: first defined here
CMakeFiles/paymentbackend.dir/moc_alkpayment.o:(.rodata+0x0): multiple definition of `AlkPayment::staticMetaObject'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:(.rodata+0x40): first defined here
CMakeFiles/paymentbackend.dir/moc_alkpayment.o: In function `AlkPayment::qt_metacall(QMetaObject::Call, int, void**)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayment.cxx:63: multiple definition of `AlkPayment::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayment.cpp:63: first defined here
CMakeFiles/paymentbackend.dir/moc_alkpayment.o: In function `AlkPayment::qt_metacast(char const*)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayment.cxx:55: multiple definition of `AlkPayment::qt_metacast(char const*)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayment.cpp:55: first defined here
CMakeFiles/paymentbackend.dir/moc_alkpayee.o: In function `AlkPayee::metaObject() const':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayee.cxx:50: multiple definition of `AlkPayee::metaObject() const'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayee.cpp:50: first defined here
CMakeFiles/paymentbackend.dir/moc_alkpayee.o:(.rodata+0x0): multiple definition of `AlkPayee::staticMetaObject'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:(.rodata+0x50): first defined here
CMakeFiles/paymentbackend.dir/moc_alkpayee.o: In function `AlkPayee::qt_metacall(QMetaObject::Call, int, void**)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayee.cxx:63: multiple definition of `AlkPayee::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayee.cpp:63: first defined here
CMakeFiles/paymentbackend.dir/moc_alkpayee.o: In function `AlkPayee::qt_metacast(char const*)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayee.cxx:55: multiple definition of `AlkPayee::qt_metacast(char const*)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_alkpayee.cpp:55: first defined here
CMakeFiles/paymentbackend.dir/moc_payment.o: In function `Payment::metaObject() const':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_payment.cxx:59: multiple definition of `Payment::metaObject() const'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_payment.cpp:59: first defined here
CMakeFiles/paymentbackend.dir/moc_payment.o:(.rodata+0x0): multiple definition of `Payment::staticMetaObject'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:(.rodata+0xb0): first defined here
CMakeFiles/paymentbackend.dir/moc_payment.o: In function `Payment::qt_metacast(char const*)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_payment.cxx:64: multiple definition of `Payment::qt_metacast(char const*)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_payment.cpp:64: first defined here
CMakeFiles/paymentbackend.dir/moc_payment.o: In function `Payment::qt_metacall(QMetaObject::Call, int, void**)':
/home/puneet/puneet/office/alkimia/payment/build/backend/moc_payment.cxx:72: multiple definition of `Payment::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o:/home/puneet/puneet/office/alkimia/payment/build/backend/moc_payment.cpp:72: first defined here
collect2: ld returned 1 exit status
make[2]: *** [backend/paymentbackend] Error 1
make[1]: *** [backend/CMakeFiles/paymentbackend.dir/all] Error 2
make: *** [all] Error 2

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} )

Errors while running tests


puneet@puneet-Studio-1458:~/puneet/office/alkimia/payment$ mkdir build
puneet@puneet-Studio-1458:~/puneet/office/alkimia/payment$ cd build
puneet@puneet-Studio-1458:~/puneet/office/alkimia/payment/build$ cmake -DKDE4_BUILD_TESTS=on ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXau.so;/usr/lib/libXdmcp.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXau.so;/usr/lib/libXdmcp.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib/libX11.so
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- Found Automoc4: /usr/bin/automoc4
-- Found Perl: /usr/bin/perl
-- Found Phonon: /usr/include
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Failed
-- Performing Test HAVE_FPIE_SUPPORT
-- Performing Test HAVE_FPIE_SUPPORT - Success
-- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL
-- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL - Success
-- Performing Test __KDE_HAVE_GCC_VISIBILITY
-- Performing Test __KDE_HAVE_GCC_VISIBILITY - Success
-- Found KDE 4.5 include dir: /usr/include
-- Found KDE 4.5 library dir: /usr/lib
-- Found the KDE4 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
-- Found automoc4: /usr/bin/automoc4
-- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
-- Found X11: /usr/lib/libX11.so
-- Found GMP: /usr/include
-- checking for module 'libalkimia'
--   found libalkimia, version 4
-- Found LibAlkimia: /usr/lib/libalkimia.so
-- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
-- Found X11: /usr/lib/libX11.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/puneet/puneet/office/alkimia/payment/build
puneet@puneet-Studio-1458:~/puneet/office/alkimia/payment/build$ make
Scanning dependencies of target Alkinvoice
[  3%] Building CXX object backend/CMakeFiles/Alkinvoice.dir/alkinvoice.o
Linking CXX static library ../lib/libAlkinvoice.a
[  3%] Built target Alkinvoice
Scanning dependencies of target Alkpayee
[  7%] Building CXX object backend/CMakeFiles/Alkpayee.dir/alkpayee.o
Linking CXX static library ../lib/libAlkpayee.a
[  7%] Built target Alkpayee
Scanning dependencies of target Alkpayment
[ 11%] Building CXX object backend/CMakeFiles/Alkpayment.dir/alkpayment.o
Linking CXX static library ../lib/libAlkpayment.a
[ 11%] Built target Alkpayment
Scanning dependencies of target Alkuser
[ 14%] Building CXX object backend/CMakeFiles/Alkuser.dir/alkuser.o
Linking CXX static library ../lib/libAlkuser.a
[ 14%] Built target Alkuser
Scanning dependencies of target alkinvoicetest_automoc
Generating moc_alkinvoicetest.cpp
[ 14%] Built target alkinvoicetest_automoc
Scanning dependencies of target alkinvoicetest
[ 18%] Building CXX object backend/CMakeFiles/alkinvoicetest.dir/alkinvoicetest_automoc.o
[ 22%] Building CXX object backend/CMakeFiles/alkinvoicetest.dir/alkinvoicetest.o
Linking CXX executable alkinvoicetest
CMakeFiles/alkinvoicetest.dir/alkinvoicetest.o: In function `AlkInvoiceTest::emptyCtor()':
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:38: undefined reference to `AlkInvoice::AlkInvoice(QObject*)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:40: undefined reference to `AlkInvoice::invoiceId() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:41: undefined reference to `AlkInvoice::uniqueId() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:44: undefined reference to `AlkInvoice::~AlkInvoice()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:42: undefined reference to `AlkInvoice::invalid() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:43: undefined reference to `AlkInvoice::documentId() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:44: undefined reference to `AlkInvoice::type() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:44: undefined reference to `AlkInvoice::~AlkInvoice()'
CMakeFiles/alkinvoicetest.dir/alkinvoicetest.o: In function `main':
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:26: undefined reference to `QApplication::QApplication(int&, char**, int)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:26: undefined reference to `QApplication::~QApplication()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:26: undefined reference to `QApplication::~QApplication()'
CMakeFiles/alkinvoicetest.dir/alkinvoicetest.o: In function `AlkInvoiceTest::settersAndGetters()':
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:73: undefined reference to `AlkInvoice::AlkInvoice(QObject*)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:80: undefined reference to `AlkInvoice::setInvoiceId(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:81: undefined reference to `AlkInvoice::setUniqueId(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:82: undefined reference to `AlkInvoice::setInvalid(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:83: undefined reference to `AlkInvoice::setDocumentId(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:84: undefined reference to `AlkInvoice::setType(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:86: undefined reference to `AlkInvoice::invoiceId() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:87: undefined reference to `AlkInvoice::uniqueId() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:90: undefined reference to `AlkInvoice::~AlkInvoice()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:90: undefined reference to `AlkInvoice::~AlkInvoice()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:88: undefined reference to `AlkInvoice::invalid() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:89: undefined reference to `AlkInvoice::documentId() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:90: undefined reference to `AlkInvoice::type() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:90: undefined reference to `AlkInvoice::~AlkInvoice()'
CMakeFiles/alkinvoicetest.dir/alkinvoicetest.o: In function `AlkInvoiceTest::copyCtor()':
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:49: undefined reference to `AlkInvoice::AlkInvoice(QObject*)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:56: undefined reference to `AlkInvoice::setInvoiceId(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:57: undefined reference to `AlkInvoice::setUniqueId(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:58: undefined reference to `AlkInvoice::setInvalid(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:59: undefined reference to `AlkInvoice::setDocumentId(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:60: undefined reference to `AlkInvoice::setType(QString const&)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:62: undefined reference to `AlkInvoice::AlkInvoice(AlkInvoice const&, QObject*)'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:64: undefined reference to `AlkInvoice::invoiceId() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:65: undefined reference to `AlkInvoice::uniqueId() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:68: undefined reference to `AlkInvoice::~AlkInvoice()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:68: undefined reference to `AlkInvoice::~AlkInvoice()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:68: undefined reference to `AlkInvoice::~AlkInvoice()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:66: undefined reference to `AlkInvoice::invalid() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:67: undefined reference to `AlkInvoice::documentId() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:68: undefined reference to `AlkInvoice::type() const'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:68: undefined reference to `AlkInvoice::~AlkInvoice()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:68: undefined reference to `AlkInvoice::~AlkInvoice()'
/home/puneet/puneet/office/alkimia/payment/backend/alkinvoicetest.cpp:68: undefined reference to `AlkInvoice::~AlkInvoice()'
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

How to turn the variable KDE4_BUILD_TESTS ON

For making executable for tests, you will have to turn the KDE4_BUILD_TEST ON
But there was no place where I found how to.

So here it is
while running cmake, you just have to write the command as " cmake -DKDE4_BUILD_TEST=on .. "

Friday, 29 July 2011

Cannot specify link libraries for target "alkpaymenttest" which is not built by this project.

I had the following output


puneet@puneet-Studio-1458:~/puneet/office/alkimia/payment/build$ cmake ..
-- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
-- Found X11: /usr/lib/libX11.so
-- Found KDE 4.5 include dir: /usr/include
-- Found KDE 4.5 library dir: /usr/lib
-- Found the KDE4 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
-- Found automoc4: /usr/bin/automoc4
-- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
-- Found X11: /usr/lib/libX11.so
-- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
-- Found X11: /usr/lib/libX11.so
CMake Error at /usr/share/kde4/apps/cmake/modules/KDE4Macros.cmake:808 (list):
  list sub-command GET requires at least three arguments.
Call Stack (most recent call first):
  backend/CMakeLists.txt:89 (kde4_add_unit_test)


CMake Error at backend/CMakeLists.txt:92 (target_link_libraries):
  Cannot specify link libraries for target "alkpaymenttest" which is not
  built by this project.

SOLUTION:

Well, this error is sometimes caused due to the non-ASCII characters (special chars) in the CMakeLists.txt

So I just wrote down the lines including alkpaymenttest again, which solved the problem.

Saturday, 23 July 2011

Some errors while adding payment.cpp


In file included from /home/puneet/puneet/office/alkimia/qtcreator-build/backend/paymentbackend_automoc.cpp:11:
/home/puneet/puneet/office/alkimia/qtcreator-build/backend/moc_payment.cpp:20: error: expected initializer before ‘qt_meta_data_payment’
/home/puneet/puneet/office/alkimia/qtcreator-build/backend/moc_payment.cpp:42: error: ‘qt_meta_data_payment’ was not declared in this scope
/home/puneet/puneet/office/alkimia/qtcreator-build/backend/moc_payment.cpp:43: error: too many initializers for ‘QMetaObject::<anonymous struct>’
make[2]: *** [backend/CMakeFiles/paymentbackend.dir/paymentbackend_automoc.o] Error 1
make[2]: Leaving directory `/home/puneet/puneet/office/alkimia/qtcreator-build'
make[1]: *** [backend/CMakeFiles/paymentbackend.dir/all] Error 2
make[1]: Leaving directory `/home/puneet/puneet/office/alkimia/qtcreator-build'
make: *** [all] Error 2
The process "/usr/bin/make" exited with code %2.
Error while building project alkimiapayment (target: Desktop)
When executing build step 'Make'



Errors like this are usually caused by an error in any of the header files processed before the qt include file.

In my case i had missed ';' in the class declaration

Wednesday, 20 July 2011

generate xml from cpp

qdbuscpp2xml
To generate the XML we will be using the qdbuscpp2xml command line tool that comes with Qt. This program takes a C++ source file and generates a D-Bus XML definition of the interface for us. It lets us to define which methods to export using the following command line switches:
qdbuscpp2xml switches
Switch Exports
-S all signals
-M all public slots
-P all properties
-A all exportable items
-s scriptable signals
-m scriptable public slots
-p scriptable properties
-a all scriptable items
In our example above we want to export all the public slots but only scriptable signals. Therefore we would use this command line:
$> qdbuscpp2xml -M -s background.h -o org.foo.Background.xml
This produces a file named org.foo.Background.xml which contains this:
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
  <interface name="org.foo.Background">
    <signal name="backgroundChanged">
    </signal>
    <method name="refreshBackground">
    </method>
    <method name="currentBackground">
      <arg type="s" direction="out"/>
    </method>
    <method name="setBackground">
      <arg type="b" direction="out"/>
      <arg name="name" type="s" direction="in"/>
    </method>
  </interface>
</node>
This file should be shipped with your project's source distribution.

Tuesday, 12 July 2011

:: error: No rule to make target `/home/puneet/puneet/office/alkimia/alkquotes/backend/org.kde.quotebackend.keyusermanager.xml', needed by `backend/keyusermanageradaptor.cpp'. Stop.

I am getting this error a lot of times


That's usually because you don't have a file called keusermanager.cpp available to make. Check that:
  • that file exists.
  • you're in the right directory when you make.
Actuall I didnt knew that we have to make this file ourselves , So I searched a bit and found it that indeed we have to make this ourselves but can be done in a faster way with almost no errors using qdbuscpp2xml switches

qdbuscpp2xml

To generate the XML we will be using the qdbuscpp2xml command line tool that comes with Qt. This program takes a C++ source file and generates a D-Bus XML definition of the interface for us. It lets us to define which methods to export using the following command line switches:
qdbuscpp2xml switches
Switch Exports
-S all signals
-M all public slots
-P all properties
-A all exportable items
-s scriptable signals
-m scriptable public slots
-p scriptable properties
-a all scriptable items
In our example above we want to export all the public slots but only scriptable signals. Therefore we would use this command line:
$> qdbuscpp2xml -M -s background.h -o org.foo.Background.xml
This produces a file named org.foo.Background.xml which contains this:
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
  <interface name="org.foo.Background">
    <signal name="backgroundChanged">
    </signal>
    <method name="refreshBackground">
    </method>
    <method name="currentBackground">
      <arg type="s" direction="out"/>
    </method>
    <method name="setBackground">
      <arg type="b" direction="out"/>
      <arg name="name" type="s" direction="in"/>
    </method>
  </interface>
</node>
This file should be shipped with your project's source distribution.

    Meaning of marking a package REQUIRED

    while coding the CMakeLists.txt we often see some packages marked as REQUIRED
    FIND_PACKAGE( QT4 REQUIRED)
    It means the build will stop if the QT4 is not present.
    refer to the page for further information http://summer-opensource.blogspot.com/2011/07/learning-cmake.html

    Learning CMAKE

    All CMake projects are described in a file called CMakeLists.txt, which corresponds to the project file that QMake uses. Each CMake file is based around a project, so the file starts by setting the project’s name to basics using the PROJECT command.

    ADD DEFENITIONS

    add_definitions( ${QT_DEFINITIONS} ${KDE4DEFINITIONS} )

    #  QT_DEFINITIONS - definitions to use when
    #                   compiling code that uses Qt.
    
    

    add library

    Add a library to the project using the specified source files.
    add_library(<name> [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL]
                  source1 source2 ... sourceN)
    Adds a library target called <name> to be built from the source files listed in the command invocation. The <name> corresponds to the logical target name and must be globally unique within a project. The actual file name of the library built is constructed based on conventions of the native platform (such as lib<name>.a or <name>.lib).
    STATIC, SHARED, or MODULE may be given to specify the type of library to be created. STATIC libraries are archives of object files for use when linking other targets. SHARED libraries are linked dynamically and loaded at runtime. MODULE libraries are plugins that are not linked into other targets but may be loaded dynamically at runtime using dlopen-like functionality. If no type is given explicitly the type is STATIC or SHARED based on whether the current value of the variable BUILD_SHARED_LIBS is true.
    By default the library file will be created in the build tree directory corresponding to the source tree directory in which the command was invoked. See documentation of the ARCHIVE_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY, and RUNTIME_OUTPUT_DIRECTORY target properties to change this location. See documentation of the OUTPUT_NAME target property to change the <name> part of the final file name.
    If EXCLUDE_FROM_ALL is given the corresponding property will be set on the created target. See documentation of the EXCLUDE_FROM_ALL target property for details.
    The add_library command can also create IMPORTED library targets using this signature:
    add_library(<name> <SHARED|STATIC|MODULE|UNKNOWN> IMPORTED)
    An IMPORTED library target references a library file located outside the project. No rules are generated to build it. The target name has scope in the directory in which it is created and below. It may be referenced like any target built within the project. IMPORTED libraries are useful for convenient reference from commands like target_link_libraries. Details about the imported library are specified by setting properties whose names begin in "IMPORTED_". The most important such property is IMPORTED_LOCATION (and its per-configuration version IMPORTED_LOCATION_<CONFIG>) which specifies the location of the main library file on disk. See documentation of the IMPORTED_* properties for more information.

    Monday, 11 July 2011

    building alkimia

    puneet@puneet-Studio-1458:~$ sudo apt-get install kdelibs5-dev
    [sudo] password for puneet:
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    The following extra packages will be installed:
      build-essential dpkg-dev libalgorithm-diff-perl libalgorithm-merge-perl
      libdpkg-perl libkimproxy4 libknewstuff2-4 libkunitconversion4 libphonon-dev
      libsoprano-dev pkg-kde-tools
    Suggested packages:
      debian-keyring libsoprano-doc debhelper cdbs
    The following NEW packages will be installed:
      build-essential dpkg-dev kdelibs5-dev libalgorithm-diff-perl
      libalgorithm-merge-perl libdpkg-perl libkimproxy4 libknewstuff2-4
      libkunitconversion4 libphonon-dev libsoprano-dev pkg-kde-tools
    0 upgraded, 12 newly installed, 0 to remove and 48 not upgraded.
    Need to get 3,276kB of archives.
    After this operation, 21.6MB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    Get:1 http://in.archive.ubuntu.com/ubuntu/ maverick-updates/main libdpkg-perl all 1.15.8.4ubuntu3.1 [505kB]
    Get:2 http://in.archive.ubuntu.com/ubuntu/ maverick-updates/main dpkg-dev all 1.15.8.4ubuntu3.1 [772kB]
    Get:3 http://in.archive.ubuntu.com/ubuntu/ maverick/main build-essential i386 11.5 [7,244B]
    Get:4 http://in.archive.ubuntu.com/ubuntu/ maverick-updates/main libknewstuff2-4 i386 4:4.5.5-0ubuntu2 [139kB]
    Get:5 http://in.archive.ubuntu.com/ubuntu/ maverick-updates/main libkimproxy4 i386 4:4.5.5-0ubuntu2 [41.5kB]
    Get:6 http://in.archive.ubuntu.com/ubuntu/ maverick-updates/main libkunitconversion4 i386 4:4.5.5-0ubuntu2 [118kB]
    Get:7 http://in.archive.ubuntu.com/ubuntu/ maverick/main pkg-kde-tools all 0.9.2ubuntu15 [105kB]
    Get:8 http://in.archive.ubuntu.com/ubuntu/ maverick/main libsoprano-dev i386 2.5.2+dfsg.1-0ubuntu1 [112kB]
    Get:9 http://in.archive.ubuntu.com/ubuntu/ maverick/main libphonon-dev i386 4:4.7.0really4.4.2-0ubuntu1 [44.3kB]
    Get:10 http://in.archive.ubuntu.com/ubuntu/ maverick-updates/main kdelibs5-dev i386 4:4.5.5-0ubuntu2 [1,367kB]
    Get:11 http://in.archive.ubuntu.com/ubuntu/ maverick/main libalgorithm-diff-perl all 1.19.02-1 [51.3kB]
    Get:12 http://in.archive.ubuntu.com/ubuntu/ maverick/main libalgorithm-merge-perl all 0.08-1 [13.0kB]
    Fetched 3,276kB in 3min 31s (15.5kB/s)                                        
    Selecting previously deselected package libdpkg-perl.
    (Reading database ... 153839 files and directories currently installed.)
    Unpacking libdpkg-perl (from .../libdpkg-perl_1.15.8.4ubuntu3.1_all.deb) ...
    Selecting previously deselected package dpkg-dev.
    Unpacking dpkg-dev (from .../dpkg-dev_1.15.8.4ubuntu3.1_all.deb) ...
    Selecting previously deselected package build-essential.
    Unpacking build-essential (from .../build-essential_11.5_i386.deb) ...
    Selecting previously deselected package libknewstuff2-4.
    Unpacking libknewstuff2-4 (from .../libknewstuff2-4_4%3a4.5.5-0ubuntu2_i386.deb) ...
    Selecting previously deselected package libkimproxy4.
    Unpacking libkimproxy4 (from .../libkimproxy4_4%3a4.5.5-0ubuntu2_i386.deb) ...
    Selecting previously deselected package libkunitconversion4.
    Unpacking libkunitconversion4 (from .../libkunitconversion4_4%3a4.5.5-0ubuntu2_i386.deb) ...
    Selecting previously deselected package pkg-kde-tools.
    Unpacking pkg-kde-tools (from .../pkg-kde-tools_0.9.2ubuntu15_all.deb) ...
    Selecting previously deselected package libsoprano-dev.
    Unpacking libsoprano-dev (from .../libsoprano-dev_2.5.2+dfsg.1-0ubuntu1_i386.deb) ...
    Selecting previously deselected package libphonon-dev.
    Unpacking libphonon-dev (from .../libphonon-dev_4%3a4.7.0really4.4.2-0ubuntu1_i386.deb) ...
    Selecting previously deselected package kdelibs5-dev.
    Unpacking kdelibs5-dev (from .../kdelibs5-dev_4%3a4.5.5-0ubuntu2_i386.deb) ...
    Selecting previously deselected package libalgorithm-diff-perl.
    Unpacking libalgorithm-diff-perl (from .../libalgorithm-diff-perl_1.19.02-1_all.deb) ...
    Selecting previously deselected package libalgorithm-merge-perl.
    Unpacking libalgorithm-merge-perl (from .../libalgorithm-merge-perl_0.08-1_all.deb) ...
    Processing triggers for man-db ...
    Setting up libdpkg-perl (1.15.8.4ubuntu3.1) ...
    Setting up dpkg-dev (1.15.8.4ubuntu3.1) ...
    Setting up build-essential (11.5) ...
    Setting up libknewstuff2-4 (4:4.5.5-0ubuntu2) ...
    Setting up libkimproxy4 (4:4.5.5-0ubuntu2) ...
    Setting up libkunitconversion4 (4:4.5.5-0ubuntu2) ...
    Setting up pkg-kde-tools (0.9.2ubuntu15) ...
    Setting up libsoprano-dev (2.5.2+dfsg.1-0ubuntu1) ...
    Setting up libphonon-dev (4:4.7.0really4.4.2-0ubuntu1) ...
    Setting up kdelibs5-dev (4:4.5.5-0ubuntu2) ...
    Setting up libalgorithm-diff-perl (1.19.02-1) ...
    Setting up libalgorithm-merge-perl (0.08-1) ...
    Processing triggers for libc-bin ...
    ldconfig deferred processing now taking place
    puneet@puneet-Studio-1458:~$ ls
    abc.c    build_svn.txt  Documents         Pictures    reliance
    abc.qif  codechef       Downloads         Public      require_kde_svn
    alkimia  def.qif        examples.desktop  puneet      Templates
    a.out    Desktop        Music             puneet.kmy  Videos
    puneet@puneet-Studio-1458:~$ cd alkimia/
    puneet@puneet-Studio-1458:~/alkimia$ cd libalkimia/
    puneet@puneet-Studio-1458:~/alkimia/libalkimia$ cd build
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ cmake ..
    -- Looking for Q_WS_X11
    -- Looking for Q_WS_X11 - found
    -- Looking for Q_WS_WIN
    -- Looking for Q_WS_WIN - not found.
    -- Looking for Q_WS_QWS
    -- Looking for Q_WS_QWS - not found.
    -- Looking for Q_WS_MAC
    -- Looking for Q_WS_MAC - not found.
    -- Found Qt-Version 4.7.0 (using /usr/bin/qmake)
    -- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXau.so;/usr/lib/libXdmcp.so
    -- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXau.so;/usr/lib/libXdmcp.so - found
    -- Looking for gethostbyname
    -- Looking for gethostbyname - found
    -- Looking for connect
    -- Looking for connect - found
    -- Looking for remove
    -- Looking for remove - found
    -- Looking for shmat
    -- Looking for shmat - found
    -- Found X11: /usr/lib/libX11.so
    -- Looking for include files CMAKE_HAVE_PTHREAD_H
    -- Looking for include files CMAKE_HAVE_PTHREAD_H - found
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - not found
    -- Looking for pthread_create in pthread
    -- Looking for pthread_create in pthread - found
    -- Found Threads: TRUE
    -- Looking for _POSIX_TIMERS
    -- Looking for _POSIX_TIMERS - found
    -- Found Automoc4: /usr/bin/automoc4
    -- Found Perl: /usr/bin/perl
    -- Found Phonon: /usr/include
    -- Performing Test _OFFT_IS_64BIT
    -- Performing Test _OFFT_IS_64BIT - Failed
    -- Performing Test HAVE_FPIE_SUPPORT
    -- Performing Test HAVE_FPIE_SUPPORT - Success
    -- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL
    -- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL - Success
    -- Performing Test __KDE_HAVE_GCC_VISIBILITY
    -- Performing Test __KDE_HAVE_GCC_VISIBILITY - Success
    -- Found KDE 4.5 include dir: /usr/include
    -- Found KDE 4.5 library dir: /usr/lib
    -- Found the KDE4 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
    -- Found automoc4: /usr/bin/automoc4
    -- Found GMP: /usr/include
    -- Could NOT find Doxygen  (missing:  DOXYGEN_EXECUTABLE)
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/puneet/alkimia/libalkimia/build
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ ls
    alkcompanytest_automoc.cpp.files    CMakeFiles             lib
    alkimia_automoc.cpp.files           cmake_install.cmake    libalkimia.pc
    alkquoteitemtest_automoc.cpp.files  CMakeTmp               Makefile
    alkvaluetest_automoc.cpp.files      cmake_uninstall.cmake
    CMakeCache.txt                      CTestTestfile.cmake
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ make
    Scanning dependencies of target alkimia_automoc
    Generating moc_alkcompany.cpp
    Generating moc_alkquoteitem.cpp
    [  0%] Built target alkimia_automoc
    Scanning dependencies of target alkimia
    [ 25%] Building CXX object CMakeFiles/alkimia.dir/alkimia_automoc.cpp.o
    [ 50%] Building CXX object CMakeFiles/alkimia.dir/alkvalue.cpp.o
    /home/puneet/alkimia/libalkimia/alkvalue.cpp:63: warning: ‘QString mpzToString(const mpz_class&)’ defined but not used
    [ 75%] Building CXX object CMakeFiles/alkimia.dir/alkquoteitem.cpp.o
    [100%] Building CXX object CMakeFiles/alkimia.dir/alkcompany.cpp.o
    Linking CXX shared library lib/libalkimia.so
    [100%] Built target alkimia
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ ls
    alkcompanytest_automoc.cpp.files    CMakeFiles             libalkimia.pc
    alkimia_automoc.cpp                 cmake_install.cmake    Makefile
    alkimia_automoc.cpp.files           CMakeTmp               moc_alkcompany.cpp
    alkquoteitemtest_automoc.cpp.files  cmake_uninstall.cmake  moc_alkquoteitem.cpp
    alkvaluetest_automoc.cpp.files      CTestTestfile.cmake
    CMakeCache.txt                      lib
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ cd lib
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build/lib$ ls
    libalkimia.so  libalkimia.so.4  libalkimia.so.4.3.0
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build/lib$ cd ..
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ make install
    Generating moc_alkcompany.cpp
    Generating moc_alkquoteitem.cpp
    [  0%] Built target alkimia_automoc
    Scanning dependencies of target alkimia
    [ 25%] Building CXX object CMakeFiles/alkimia.dir/alkimia_automoc.cpp.o
    Linking CXX shared library lib/libalkimia.so
    [100%] Built target alkimia
    Install the project...
    -- Install configuration: "RelWithDebInfo"
    -- Installing: /usr/lib/libalkimia.so.4.3.0
    CMake Error at cmake_install.cmake:48 (FILE):
      file INSTALL cannot copy file
      "/home/puneet/alkimia/libalkimia/build/lib/libalkimia.so.4.3.0" to
      "/usr/lib/libalkimia.so.4.3.0".


    make: *** [install] Error 1
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ make install
    [  0%] Built target alkimia_automoc
    [100%] Built target alkimia
    Install the project...
    -- Install configuration: "RelWithDebInfo"
    -- Installing: /usr/lib/libalkimia.so.4.3.0
    CMake Error at cmake_install.cmake:48 (FILE):
      file INSTALL cannot copy file
      "/home/puneet/alkimia/libalkimia/build/lib/libalkimia.so.4.3.0" to
      "/usr/lib/libalkimia.so.4.3.0".


    make: *** [install] Error 1
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ ls
    alkcompanytest_automoc.cpp.files  alkquoteitemtest_automoc.cpp.files  CMakeFiles           cmake_uninstall.cmake  libalkimia.pc       moc_alkquoteitem.cpp
    alkimia_automoc.cpp               alkvaluetest_automoc.cpp.files      cmake_install.cmake  CTestTestfile.cmake    Makefile
    alkimia_automoc.cpp.files         CMakeCache.txt                      CMakeTmp             lib                    moc_alkcompany.cpp
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ gedit cmake_install.cmake
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ make install
    [  0%] Built target alkimia_automoc
    [100%] Built target alkimia
    Install the project...
    -- Install configuration: "RelWithDebInfo"
    CMake Error at cmake_install.cmake:48 (FILE):
      file called with unknown argument
      "/home/puneet/alkimia/libalkimia/build/lib/libalkimia.so.4.3.0".


    make: *** [install] Error 1
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ make install
    [  0%] Built target alkimia_automoc
    [100%] Built target alkimia
    Install the project...
    -- Install configuration: "RelWithDebInfo"
    -- Installing: /usr/lib/libalkimia.so.4.3.0
    CMake Error at cmake_install.cmake:48 (FILE):
      file INSTALL cannot copy file
      "/home/puneet/alkimia/libalkimia/build/lib/libalkimia.so.4.3.0" to
      "/usr/lib/libalkimia.so.4.3.0".


    make: *** [install] Error 1
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ su
    Password:
    su: Authentication failure
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$ sudo sudo ^C
    puneet@puneet-Studio-1458:~/alkimia/libalkimia/build$

    To install KDE-SVN you will need the following to be installed

    Requires
    libapr1 (>= 1.2.7)
    libaprutil1 (>= 1.2.7+dfsg)
    libc6 (>= 2.3.6-6~)
    libdb4.8
    libgcc1 (>= 1:4.1.1)
    libkdecore5 (>= 4:4.4.0)
    libkdeui5 (>= 4:4.3.4)
    libkio5 (>= 4:4.5.0b)
    libqt4-dbus (>= 4:4.5.3)
    libqt4-network (>= 4:4.5.3)
    libqt4-sql (>= 4:4.5.3)
    libqt4-svg (>= 4:4.5.3)
    libqt4-xml (>= 4:4.5.3)
    libqtcore4 (>= 4:4.7.0~beta1)
    libqtgui4 (>= 4:4.5.3)
    libstdc++6 (>= 4.1.1)
    libsvn1 (>= 1.4)
    libsvnqt6 (>= 1.5.4)

    error while runnning make libalkimia including two files made by me

    Here is the pastebin's link http://pastebin.com/P7QuGPP6

    In file included from /usr/include/qt4/QtCore/QMetaType:1,
                     from /home/puneet/alkimia/build/libalkimia/../../libalkimia/alkcompany.h:26,
                     from /home/puneet/alkimia/build/libalkimia/moc_alkcompany.cpp:10,
                     from /home/puneet/alkimia/build/libalkimia/alkimia_automoc.cpp:4:
    /usr/include/qt4/QtCore/qmetatype.h: In function ‘void* qMetaTypeConstructHelper(const T*) [with T = AlkUser]’:
    /usr/include/qt4/QtCore/qmetatype.h:185:   instantiated from ‘int qRegisterMetaType(const char*, T*) [with T = AlkUser]’
    /home/puneet/alkimia/build/libalkimia/../../libalkimia/alkuser.h:58:   instantiated from here
    /usr/include/qt4/QtCore/qmetatype.h:141: error: no matching function for call to ‘AlkUser::AlkUser()’
    /home/puneet/alkimia/build/libalkimia/../../libalkimia/alkuser.h:35: note: candidates are: AlkUser::AlkUser(const AlkUser&, QObject*)
    /home/puneet/alkimia/build/libalkimia/../../libalkimia/alkuser.h:34: note:                 AlkUser::AlkUser(QObject*)
    /home/puneet/alkimia/build/libalkimia/../../libalkimia/alkuser.h:31: note:                 AlkUser::AlkUser(const AlkUser&)
    In file included from /home/puneet/alkimia/build/libalkimia/moc_alkuser.cpp:10,
                     from /home/puneet/alkimia/build/libalkimia/alkimia_automoc.cpp:5:
    /usr/include/qt4/QtCore/qobject.h: In copy constructor ‘AlkUser::AlkUser(const AlkUser&)’:
    /usr/include/qt4/QtCore/qobject.h:309: error: ‘QObject::QObject(const QObject&)’ is private
    /home/puneet/alkimia/build/libalkimia/../../libalkimia/alkuser.h:31: error: within this context
    In file included from /usr/include/qt4/QtCore/QMetaType:1,
                     from /home/puneet/alkimia/build/libalkimia/../../libalkimia/alkcompany.h:26,
                     from /home/puneet/alkimia/build/libalkimia/moc_alkcompany.cpp:10,
                     from /home/puneet/alkimia/build/libalkimia/alkimia_automoc.cpp:4:
    /usr/include/qt4/QtCore/qmetatype.h: In function ‘void* qMetaTypeConstructHelper(const T*) [with T = AlkUser]’:
    /usr/include/qt4/QtCore/qmetatype.h:142: note: synthesized method ‘AlkUser::AlkUser(const AlkUser&)’ first required here
    make[2]: *** [libalkimia/CMakeFiles/alkimia.dir/alkimia_automoc.cpp.o] Error 1
    make[1]: *** [libalkimia/CMakeFiles/alkimia.dir/all] Error 2
    make: *** [all] Error 2

    Sunday, 10 July 2011

    What is astyle formatting?

    It automatically formats your code according to the formatting you set.
    For ease you can make a shell file for once and can use it always to use it.
    For this you need to install astyle which you can easily do using

    sudo apt-get install astlye

    I have uploaded the one I used in my project here

    It also makes its original copy with the extension .orig 


    Saturday, 9 July 2011

    Errors while commiting to svn

    When i commit, i am having an error saying
    "

    Commit failed (details follow):
    Authorization failed"

    I had used the working copy which was not checked out using svn+ssh
    This was wat the mistake was

    Thursday, 7 July 2011

    Create your SSH key

    You need a SSH public key in order to access your KDE SVN account

    Generating the SSH keys

    To be able to use your KDE SVN account with SSH, you need a SSH public key. Please notice that it is not a GPG (OpenPGP) key, which is completely unrelated!
    The password in the sense of this documentation is the public key that you are creating.
    For more information on how to create a pair o SSH keys, please refer to a SSH documentation or book.
    In short, the command to create a pair of keys is ssh-keygen and it requires the type of key you will create, either DSA or RSA - both are fine.
    To create a new pair of keys, use
    ssh-keygen -t dsa
    or
    ssh-keygen -t rsa
    There is also a type called RSA1 which was used in version 1 of the SSH protocol. See the ssh documentation for more details.
    You can then accept the default filename for your key (either $HOME/.ssh/id_dsa or $HOME/.ssh/id_rsa, depending on the type of key you have chosen). After that, a passphrase is asked. It is recommended that you do not leave it blank.
    Now that you are finished generating your key pair, you will have two files: a private key and a public key. If you have accepted the default filename, they will be respectively $HOME/.ssh/id_dsa and $HOME/.ssh/id_dsa.pub or $HOME/.ssh/id_rsa and $HOME/.ssh/id_rsa.pub, depending on the type of key you have specified.
    The private key must remain secret, do not publish it to anyone under any circumstance.

    The public key can be published and shall be sent when you are applying for a KDE SVN account.

    You should also set up ssh-agent so you do not have to type the password every time you connect via SSH. There are several tutorials available explaining how to do this, for example this one. Keychain is a program that makes this task easier.
    Note: if you already have an ssh key, you can just use the existing key instead of creating a new one.



    If you want to use SVN with SSH with another user than the one who created the keys, you need to copy $HOME/.ssh/id_dsa.pub and $HOME/.ssh/id_dsa or $HOME/.ssh/id_rsa.pub and $HOME/.ssh/id_rsa to the other user's $HOME/.ssh directory.
    You should probably also backup those files.

    Sunday, 3 July 2011

    alkuser.cpp

    #include "alkuser.h"

    #include<QDBusMetaType>
    #include<QDBusArgument>

    class AlkUser::Private
    {
    public:
        QString m_name;
        Q_String m_account_no;
        Q_String m_contact;
        Q_String m_type;
        Q_String m_amount;
    }

    AlkUser::AlkUser(QObject *Parent) :
    QObject(parent),
    d(new Private)
    {
    }

    AlkUser::~Alkuser(){}

    AlkUser::AlkUser(const AlkUser &user,QObject *parent):
    QObject(parent),
    d(new Private)
    {
        setName(user.name());
        setAccount_no(user.account());
        setContact(user.contact());
        setType(user.type);
        setAmount(user.amount);
    }

    const QString& AlkUser::name()
    {
    return d->m_name;
    }

    const QString& AlkUser::account()
    {
        return d->m_account_no;
    }

    const QString& AlkUser::contact()
    {
        return d->m_contact;
    }

    const QString& AlkUser::type()
    {
        return d->m_type;
    }

    const QString& AlkUser::amount()
    {
        return d->m_amount;
    }

    void AlkUser::setName(QString &name)
    {
        d->m_name=name;
    }

    void AlkUser::setAccount(QString &account_no)
    {
        d->m_account_no=account_no;
    }

    void AlkUser::setContact(QString &contact)
    {
        d->m_contact=contact;
    }

    void AlkUser::setType(QString &type)
    {
        d->m_type=type;
    }

    void AlkUser::setAmount(QString &amount)
    {
        d->m_amount=amount;
    }

    QDBusArgument& operator<<(QDBusArgument &argument,AlkUser &user)
    {
        argument.beginStructure();
            argument << user.name() << user.account() << user.contact() << user.type() << user.amount();
            argument.endStructure();
        return argument;
    }

    const QDBusArgument& operator>>(QDBusArgument &argument,AlkUser &user)
    {
        argument.beginStructure();
            QString name;
            QString account;
            QString contact;
            QString type;
            QString amount;
            argument >> name >> account >> contact >> type >> amount;
            user.setName(name);
            user.setAccount(account);
            user.setContact(contact);
            user.setType(type);
            user.setAmount(amount);
        argument.endStructure();
        return argument;
    }

    alkUser.h

    #ifndef ALKUSER_H
    #define ALKUSER_H

    #include "alk_export.h"

    #include<QMetaType>
    #include<QDBusArgument>
    #include<QObject>
    #include<QString>

    class ALK_EXport AlkUser :public QObject
    {
        Q_Object
        public:
        AlkUser(QObject* parent=0);
        AlkUser(const AlkUser &user,QOject *parent=0);
        ~AlkUser();

        const QString& user() const;
        const QString& account() const;
        const QString& contact() const;
        const QString& type() const;
        const QString& amount() const;
       
        void setName(const QString& name);
        void setAccount(const QString& account);
        void setContact(const QString& contact);
        void setType(const QString& type);
        void setAmount(const QString& amount);

        private:
        class Private;
        Private* const d;
    };

    ALK_EXPORT QDBusArgument& operator<<(QDBusArgument& argument, const AlkUser &user);
    ALK_EXPORT const QDBusArgument& operator>>(const QDBusArgument& argument, AlkUser &user);

    Q_DECLARE_METATYPE(AlkUser)

    #endif

    keyUserManager.h

    #ifndef KEY_DATA_MANAGER_H
    #define KEY_DATA_MANAGER_H
    #include "alkuser.h"
    #include <QDBusVariant>
    #include <QObject>
    #include <QString>
    #include <QSqlQuery>
    #include <QSqlError>

    class KeyUserManager : public QObject
    {
        Q_Object
    public:
        KeyUserManager(QObject *parent);
        ~KeyUserManager();
      
        void registerDBus();
      
    public slots:


      /**
        * This is a public DBus function for retrieving a User's info for the requested keys.
        *
        * @param[in] user The user to get data for.  May be we can define a seperate id
        * @param[in] keys The list of keys to return values for.
        * @return The values in the returned QStringList will always match the order of requested keys.
        */
      Q_SCRIPTABLE QDBusVariant getUserInfo(const QString& user);



    signals:

    protected:

      /**
        * db_insertUser gets called by db_updateUser() if a user doesn't yet exist in the database.
        *
        * @param[in] user The user to add to the database.
        * @return Whether or not the insert worked.
        */
      void insertUserInfo(const QString& user);

      /**
        * Call db_updateUser to write newly downloaded results to the database.
        *
        * @param user The user whose results these represent.
        * @param keys The keys which were requested to be downloaded. Their order is relative to results.
        * @param values The downloaded values for every key. Position is relative to the keys list.
        * @return Whether or not the update worked.
        */
      void updateUserData(const QString& user, const AlkUser& userInfo, const AlkQuoteItem& quoteItem);

     
    private:

      StorageManager *m_storageManager;
      KeyPluginsManager *m_keyPluginsManager;
      QStringList m_usersBeingInitialized;

      // database stuff
      QString m_userInfoTable; // the name of the database table to use for storing info about the user
      QString m_userValueTable; // the name of the database table to use for storing value data

    };

    #endif

    keyUserManager.cpp

    #include "keyusermanager.h"
    #include "QDebug"

    KeyUserManager::KeyUserManager(StorageManager *storageManager,KeyPluginsManager *pluginManager,QObject *parent)
        : QObject(parent),
        m_storagemanager(storageManager),
        m_KeyPluginsManager(pluginManager)

    {
        m_userInfoTable=m_storageManger->userInfoTable();
    }

    KeyUserManger::registerDBus()
    {
        new KeyUserManagerAdaptor(this);
        QDBusConnection dbus=QDBusConnection::sessionBus();
        dbus.registerObject("/KeyUserManager",this);
        dbus.registerService("org.kde.alkimia.quotes");
      
    }

    KeyUserManager::~KeyUserManager()
    {
          QDBusConnection::sessionBus().unregisterObject("/KeyUserManager");
    }

    QDBusVariant KeyUserManager::getUserInfo(constant Qstring &user)
    {
        QString selectColumns=m_storageManger->userInfoTextColumns().join(",");
        QSqlQuery query(m_storageManager->database());
        query.prepare("SELECT " + selectColumns + " FROM " + m_UserInfoTable + " WHERE user=:user");
        query.bindValue(":user", user);
        query.exec();
        AlkUser userInfo;
        if(query.first() && query.isValid())
        {
            QStringList resultList; // container list for the values to-be-returned

            userInfo.setInfo(query.value(0).toString());
            userInfo.setName(query.value(1).toString());
            userInfo.setType(query.value(2).toString());
            userInfo.setExchange(query.value(3).toString());
      
            qDebug() << "Info: " << userInfo.info();
                qDebug() << "name: " << userInfo.name();
                qDebug() << "type: " << userInfo.type();
                qDebug() << "exchange: " << userInfo.exchange();
        }
         QVariant qVariant = QVariant::fromValue<AlkUser>(userInfo);
          return QDBusVariant(qVariant);
    }

    void KeyDataManager::insertUserInfo(const QString &user)
    {
      QSqlQuery query(m_storageManager->database());
      query.prepare("SELECT user FROM " + m_userInfoTable + " WHERE user=:user");        // i have a little doubt on this statement
      query.bindValue(":user", user);
      query.exec();
     
      if (!query.first() || !query.isValid()) {
        qDebug() << "KeyDataManager::db_insertUser: creating a new entry for: " + user;

        query.prepare("INSERT INTO " + m_userInfoTable + " (account, user) VALUES(NULL, :user)");
        query.bindValue(":user", user);

        // check to make sure the INSERT query worked
        query.exec();
        if (query.lastError().isValid()) {
          qWarning() << "KeyDataManager::db_insertUser failed: " + query.lastError().text();
        }
      }
    }

    void KeyDataManager::updateUserData(const QString &user, const AlkUser& userInfo, const AlkQuoteItem& quoteItem)
    {
      qDebug() << "entering KeyDataManager::db_updateUser: " + user;
      QSqlQuery query(m_storageManager->database());

      insertUserInfo(user);
     
      // Update the user info table
      // even if this user was new, we still need to update its entry in the database with the downloaded values
      QString queryUpdateInfo = "UPDATE " + m_userInfoTable + " SET ";

      // populate queryUpdate with the specific column-value pairs to update for this user
      queryUpdateInfo += "name=:name, type=:type, account=:account, amount=:amount";
     
      queryUpdateInfo += " WHERE user=:user";

      qDebug() << "db_updateUser query: " + queryUpdateInfo;
      query.prepare(queryUpdateInfo);
      
      query.bindValue(":user", user);
      query.bindValue(":name", companyInfo.name());
      query.bindValue(":type", companyInfo.type());
      query.bindValue(":account", companyInfo.account()
      query.bindValue(":amount", companyInfo.amount());
     
      query.exec();
      if (query.lastError().isValid()) {
        qWarning() << "KeyDataManager::db_updateUser failed: " + query.lastError().text();
      }
     
    }