maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Qt and MADDE next steps (https://talk.maemo.org/showthread.php?t=46734)

postformac 2010-03-07 19:31

Qt and MADDE next steps
 
Hi,

I'm trying to learn to write apps for my N900, just for fun and personal interest really. My background is mainly embedded C programming and I have pretty much no experience of programming in Linux. I'm using a Windows PC for the work so initially tried the whole virtual machine method but have now switched to using MADDE and Qt which seems a lot simpler.

After following many of the useful guides and posts available here I have managed to write a simple app and run it on the device from within Qt (yay!) but I'm not sure where I need to go from there to get my app running directly on the device.

From reading I think I need to build my source code into a package using MADDE, is that correct? I am trying to do that following the "MADDE/Qt example" guide but I am a little confused on what to do exactly. I have created the skeleton project as described, put my source files into it and altered the .pro file to include my files but I get a lot of error messages when I try to make it so I'm obviously doing something wrong. This is the output I get:

g++ -c -pipe -O0 -Wall -W -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1 -qt453/usr/share/qt4/mkspecs/default -I. -Ibuild -o build/main.o src/main.cpp
src/main.cpp:1:30: error: QtGui/QApplication: No such file or directory
In file included from src/main.cpp:2:
src/dialog.h:4:23: error: QMainWindow: No such file or directory
In file included from src/main.cpp:2:
src/dialog.h:10: error: expected class-name before '{' token
src/dialog.h:11: error: ISO C++ forbids declaration of 'Q_OBJECT' with no type
src/dialog.h:12: error: expected ';' before 'public'
src/dialog.h:16: error: expected `:' before 'slots'
src/dialog.h:17: error: expected primary-expression before 'void'
src/dialog.h:17: error: ISO C++ forbids declaration of 'slots' with no type
src/dialog.h:17: error: expected ';' before 'void'
src/dialog.h:20: error: 'QEvent' has not been declared
src/main.cpp: In function 'int main(int, char**)':
src/main.cpp:6: error: 'QApplication' was not declared in this scope
src/main.cpp:6: error: expected `;' before 'a'
src/dialog.h:14: error: 'Dialog::~Dialog()' is private
src/main.cpp:7: error: within this context
src/main.cpp:11: error: 'class Dialog' has no member named 'show'
src/main.cpp:13: error: 'a' was not declared in this scope
src/main.cpp: At global scope:
src/main.cpp:4: warning: unused parameter 'argc'
src/main.cpp:4: warning: unused parameter 'argv'
make: *** [build/main.o] Error 1


Could someone please tell me firstly if this is the correct route to progress from running the app inside Qt and if so then what I may be doing wrong?

Thanks

danielwilms 2010-03-08 08:18

Re: Qt and MADDE next steps
 
Hi,

if you want to compile it for your device you simply have to run:

Code:

mad qmake
mad make

and then copy the binary over. There is as well a guide how to connect the device with you PC. If you want to compile for your host-machine afterwards run:

Code:

mad make clean
qmake
make

Then you can run the binary on your host system.

Daniel

postformac 2010-03-08 10:00

Re: Qt and MADDE next steps
 
Hi Daniel,

I have run those commands, it is when I run mad make that I get the output as above.

Let me check if I have this right:

1. My output from Qt is basically just my source files - (a couple of .cpp files, a .h file, a .ui file and a .pro file) along with all the .o files and a couple of makefiles.

2. I have to create a skeleton project in my MADDE terminal using "mad pscreate -t qt_simple <projectname>

3. I copy my .cpp and .h files to the src directory in the newly created project (removing the created main.cpp and replacing with my own) and copy my .ui file to the uis directory

4. I open the created .pro file and edit it to include the names of my source, header and form (ui) files

5. I cd to the project directory and run mad qmake - works fine

6. run mad make - I get the output as below with an error at the end:

Code:

mark.mcdonnell $ mad make
c:/MADDE/0.6.14/targets/fremantle-qt-0951/bin/uic uis/dialog.ui -o build/ui_dial                                                      og.h
g++ -c -pipe -O0 -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I                                                      ../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/share/qt4/mkspecs/                                                      default -I. -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/incl                                                      ude/qt4/QtCore -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/i                                                      nclude/qt4/QtGui -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr                                                      /include/qt4 -Ibuild -Ibuild -o build/main.o src/main.cpp
gcc -c -pipe -O0 -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I                                                      ../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/share/qt4/mkspecs/                                                      default -I. -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/incl                                                      ude/qt4/QtCore -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/i                                                      nclude/qt4/QtGui -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr                                                      /include/qt4 -Ibuild -Ibuild -o build/.o c:/
arm-none-linux-gnueabi-gcc.exe: c:/: linker input file unused because linking no                                                      t done
g++ -c -pipe -O0 -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I                                                      ../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/share/qt4/mkspecs/                                                      default -I. -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/incl                                                      ude/qt4/QtCore -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/i                                                      nclude/qt4/QtGui -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr                                                      /include/qt4 -Ibuild -Ibuild -o build/dialog.o src/dialog.cpp
C:/MADDE/0.6.14/targets/fremantle-qt-0951/bin/moc -DQT_GUI_LIB -DQT_CORE_LIB -DQ                                                      T_SHARED -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/share/q                                                      t4/mkspecs/default -I. -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt4                                                      53/usr/include/qt4/QtCore -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-                                                      qt453/usr/include/qt4/QtGui -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-                                                      1-qt453/usr/include/qt4 -Ibuild -Ibuild src/dialog.h -o build/moc_dialog.cpp
g++ -c -pipe -O0 -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I                                                      ../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/share/qt4/mkspecs/                                                      default -I. -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/incl                                                      ude/qt4/QtCore -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/i                                                      nclude/qt4/QtGui -I../../../sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr                                                      /include/qt4 -Ibuild -Ibuild -o build/moc_dialog.o build/moc_dialog.cpp
g++  -o build/designerexample build/main.o build/.o build/dialog.o build/moc_dia                                                      log.o    -LC:/MADDE/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/usr/                                                      lib -Wl,-rpath-link=/usr/lib -lQtGui -lQtCore -lpthread
arm-none-linux-gnueabi-g++.exe: build/.o: No such file or directory
make: *** [build/designerexample] Error 1

I'm not sure if I am doing the right thing with creating the skeleton project and putting my files into it, does that sound correct?

Thanks

rontti 2010-03-08 10:24

Re: Qt and MADDE next steps
 
Quote:

Originally Posted by postformac (Post 559614)
Hi Daniel,

I'm not sure if I am doing the right thing with creating the skeleton project and putting my files into it, does that sound correct?

Thanks

If you send your .pro file we might help. The whole source package
is even better.

postformac 2010-03-08 10:33

Re: Qt and MADDE next steps
 
1 Attachment(s)
Ok, this is my complete MADDE project folder after trying unsuccessfully to run the mad make command.

Thanks

too 2010-03-08 13:42

Re: Qt and MADDE next steps
 
Quote:

Originally Posted by postformac (Post 559651)
Ok, this is my complete MADDE project folder after trying unsuccessfully to run the mad make command.

Thanks

I took off the '\' in SOURCES line of qtprog.pro, re-entered
mad qmake and compilation succeeded.

postformac 2010-03-08 13:49

Re: Qt and MADDE next steps
 
Yes you're right, that works for me too. I thought I had to put a \ between listed files as that is what QtCreator has done in its project file, my mistake.

Thanks very much

TNiga 2010-03-08 14:43

Re: Qt and MADDE next steps
 
You only need the \ if the list continues on the next line.

postformac 2010-03-08 14:46

Re: Qt and MADDE next steps
 
Quote:

Originally Posted by TNiga (Post 559962)
You only need the \ if the list continues on the next line.

Ok, thanks very much!


All times are GMT. The time now is 09:19.

vBulletin® Version 3.8.8