Friday, July 25th 2008, 2:41am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

1

Friday, February 8th 2008, 9:48am

qtopia sample code compiling issues

Hello,
I am new to Linux development and I have no idea how to get around this. Kindly help me out.

I installed qtopia on my system through an rpm named qtopia-free-1.7.0-2rh9.i386.rpm.
now when i try to compile a sample code hello2.cpp with the following contents:

#include <qtopia/qpeapplication.h>
int main(int argc, char **argv)
{
QPEApplication a(argc, argv);

return a.exec();
}

I get the following error:

[root@localhost bin]# ./arm-linux-g++ -I /opt/Qtopia/sharp/include/ -DQWS -fno-rtti -o hello2.o -c hello2.cpp
[root@localhost bin]# ./arm-linux-g++ -L /opt/Qtopia/sharp/lib/ -o hello2 hello2.o -lqte -lqpe -ljpeg -luuid
hello2.o(.text+0x6c): In function `main':
: undefined reference to `QPEApplication::QPEApplication[in-charge](int&, char**, QApplication::Type)'
hello2.o(.text+0xa4): In function `main':
: undefined reference to `QMainWindow::QMainWindow[in-charge](QWidget*, char const*, unsigned)'
hello2.o(.text+0xfc): In function `main':
: undefined reference to `QString::QString[in-charge](char const*)'
hello2.o(.text+0x1a8): In function `main':
: undefined reference to `QPEApplication::showMainWidget(QWidget*, bool)'
hello2.o(.text+0x1b4): In function `main':
: undefined reference to `QPEApplication::exec()'
hello2.o(.text+0x1cc): In function `main':
: undefined reference to `QPEApplication::~QPEApplication [in-charge]()'
hello2.o(.text+0x1f4): In function `main':
: undefined reference to `QPEApplication::~QPEApplication [in-charge]()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0xc): undefined reference to `QGList::clear()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x10): undefined reference to `QGList::~QGList [in-charge]()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x14): undefined reference to `QGList::~QGList [in-charge deleting]()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x18): undefined reference to `QCollection::newItem(void*)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x1c): undefined reference to `QCollection::deleteItem(void*)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x20): undefined reference to `QGList::compareItems(void*, void*)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x24): undefined reference to `QGList::read(QDataStream&, void*&)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x28): undefined reference to `QGList::write(QDataStream&, void*) const'
hello2.o(.gnu.linkonce.t._ZN7QStringD1Ev+0x64): In function `QString::~QString [in-charge]()':
: undefined reference to `QStringData::deleteSelf()'
hello2.o(.gnu.linkonce.t._ZN7QStringD1Ev+0x70): In function `QString::~QString [in-charge]()':
: undefined reference to `QString::shared_null'
collect2: ld returned 1 exit status
[root@localhost bin]# ./arm-linux-g++ -I /opt/Qtopia/sharp/include/ -DQWS -fno-rtti -o hello2.o -c hello2.cpp
[root@localhost bin]# ./arm-linux-g++ -L /opt/Qtopia/sharp/lib/ -o hello2 hello2.o -lqte -lqpe -ljpeg -luuid
hello2.o(.text+0x6c): In function `main':
: undefined reference to `QPEApplication::QPEApplication[in-charge](int&, char**, QApplication::Type)'
hello2.o(.text+0x80): In function `main':
: undefined reference to `QPEApplication::exec()'
hello2.o(.text+0x98): In function `main':
: undefined reference to `QPEApplication::~QPEApplication [in-charge]()'
hello2.o(.text+0xcc): In function `main':
: undefined reference to `QPEApplication::~QPEApplication [in-charge]()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0xc): undefined reference to `QGList::clear()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x10): undefined reference to `QGList::~QGList [in-charge]()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x14): undefined reference to `QGList::~QGList [in-charge deleting]()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x18): undefined reference to `QCollection::newItem(void*)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x1c): undefined reference to `QCollection::deleteItem(void*)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x20): undefined reference to `QGList::compareItems(void*, void*)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x24): undefined reference to `QGList::read(QDataStream&, void*&)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x28): undefined reference to `QGList::write(QDataStream&, void*) const'
collect2: ld returned 1 exit status

I am using Fedora 6 and compiling for arm target board running on Linux.I want to use qt/embedded for displaying graphics on a TFT LCD connected to arm9 board.

thanks,
ramandeep
contact email: ramandeeps@cimcon.com

This post has been edited 1 times, last edit by "ramandeep" (Feb 8th 2008, 11:50am)

  • Go to the top of the page

2

Monday, February 11th 2008, 6:49am

Re

Hi RamanDeep,

Which editor r using to create the application ?

If u r using kdevelop then u have to do some settings to run your application.

The error seem related to linking....

Give us more information that which editor u r using,how r u compiling the code etc. , so that I

can help u :)
  • Go to the top of the page

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

3

Monday, February 11th 2008, 7:20am

RE: Re

Thanks for your interest Mr. Bargi.
At present I am not using any editor as such.After installing the rpm I was just tring to execute a sample code to check.

I followed the procedure according to the following link
http://www.kevinboone.com/myfirstqtopiaapp1.html
http://www.kevinboone.com/myfirstqtopiaapp2.html
http://www.kevinboone.com/myfirstqtopiaapp3.html

I am using arm-linux-gcc as compiler.while compiling I just do the following

cd/usr/local/arm/3.3.2/bin
./arm-linux-g++ -o hello2 hello2.cpp

which leads to the error.

My compiler is working fine since I can compile simple codes on my PC and execute it on the board.
For exmaple I could compile hello1.cpp

#include <iostream.h>
int main(int argc, char **argv)
{ cout << "Hello, world!\n"; }

I can also see the files installed at /opt/Qtopia/sharp/lib/ .All the header files are there including QPEApplication.h and QString.h.

Some Problem with path I guess....but somehow I cant get around this ..Plzz help

Ramandeep
  • Go to the top of the page

4

Monday, February 11th 2008, 10:19am

Re

Hi RamanDeep,

I have created the same application and it is compiled fine and also linked ,therefore creating t
executable .........

I think the problem lies in your environment variable settings.......??
Can you write the command u run to compile and details of your .bashrc or .bash_profile file ????

Also have you installed all the packages before compilation ????

Thanks

This post has been edited 1 times, last edit by "Bargi" (Feb 11th 2008, 10:27am)

  • Go to the top of the page

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

5

Monday, February 11th 2008, 11:21am

RE: Re

Hello Mr. Bargi,
this is my hello2.cpp program

#include <qmainwindow.h>
#include <qpe/qpeapplication.h>

int main(int argc, char** argv)
{
QPEApplication app(argc, argv);
QMainWindow* mainWindow = new QMainWindow();
mainWindow->setCaption("Hello, World!");
app.showMainWidget(mainWindow);
return app.exec();
}

I have arm-linux-gcc installed at /usr/local/arm/3.3.2.Therefore before compiling I copy the source files(hello2.cpp) to /usr/local/arm/3.3.2/bin and then run the following command

[root@localhost bin]# cd /usr/local/arm/3.3.2/bin
following is the command I use to compile the file:

[root@localhost bin]# ./arm-linux-g++ -I /opt/Qtopia/sharp/include/ -DQWS -fno-rtti -o hello2.o -c hello2.cpp

following is the command I use to link the files:

[root@localhost bin]# ./arm-linux-g++ -L /opt/Qtopia/sharp/lib/ -o hello2 hello2.o -lqte -lqpe -ljpeg -luuid

following is the error I get:

hello2.o(.text+0x6c): In function `main':
: undefined reference to `QPEApplication::QPEApplication[in-charge](int&, char**, QApplication::Type)'
hello2.o(.text+0xa4): In function `main':
: undefined reference to `QMainWindow::QMainWindow[in-charge](QWidget*, char const*, unsigned)'
hello2.o(.text+0xfc): In function `main':
: undefined reference to `QString::QString[in-charge](char const*)'
hello2.o(.text+0x1a8): In function `main':
: undefined reference to `QPEApplication::showMainWidget(QWidget*, bool)'
hello2.o(.text+0x1b4): In function `main':
: undefined reference to `QPEApplication::exec()'
hello2.o(.text+0x1cc): In function `main':
: undefined reference to `QPEApplication::~QPEApplication [in-charge]()'
hello2.o(.text+0x1f4): In function `main':
: undefined reference to `QPEApplication::~QPEApplication [in-charge]()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0xc): undefined reference to `QGList::clear()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x10): undefined reference to `QGList::~QGList [in-charge]()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x14): undefined reference to `QGList::~QGList [in-charge deleting]()'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x18): undefined reference to `QCollection::newItem(void*)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x1c): undefined reference to `QCollection::deleteItem(void*)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x20): undefined reference to `QGList::compareItems(void*, void*)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x24): undefined reference to `QGList::read(QDataStream&, void*&)'
hello2.o(.gnu.linkonce.r._ZTV6QGList+0x28): undefined reference to `QGList::write(QDataStream&, void*) const'
hello2.o(.gnu.linkonce.t._ZN7QStringD1Ev+0x64): In function `QString::~QString [in-charge]()':
: undefined reference to `QStringData::deleteSelf()'
hello2.o(.gnu.linkonce.t._ZN7QStringD1Ev+0x70): In function `QString::~QString [in-charge]()':
: undefined reference to `QString::shared_null'
collect2: ld returned 1 exit status

I have also tried copying the header files into the bin drirectory but that didnt help.
Yes I have installed the full package
I carried out
rpm -i qtopia-free-1.7.0-2rh9.i386.rpm
after downloading the file and placing in the root dirctory
I downloaded it from here
http://www.qtopia.org.cn/ftp/mirror/ftp.…0-2rh9.i386.rpm

Do we need to install
Qt/Embedded 2.3.x
Qt 2.3.2 for X11
to get the compilation going?

Thanks,
Ramandeep
  • Go to the top of the page

6

Monday, February 11th 2008, 11:48am

Re

Did u install following packages which is required for building application as specified in link provided by u:

Quoted


binutils-cross-arm-2.11.2-0.i386.rpm
gcc-cross-sa1100-2.95.2-0.i386.rpm
glibc-arm-2.2.2-0.i386.rpm
linux-headers-arm-sa1100-2.4.6-3.i386.rpm


If u have not installed above packages then install them.........

What I have done is as follow:

a) Install the Qtopia in /opt/Qtopia

b) Install above packages

c) To Compile run command:

/opt/Embedix/tools/bin/arm-linux-g++ -I /opt/Qtopia/sharp/include/ -DQWS -fno-rtti -o Test.o -c Test.cpp

It creates Test.o file.This command run from the Directory in which your C++ file is kept.

d) To link :
/opt/Embedix/tools/bin/arm-linux-g++ -L /opt/Qtopia/sharp/lib/ -o Test Test.o -lqte -lqpe -ljpeg -luuid

It creates Test executable.

If still u have problem let me know...........
  • Go to the top of the page

7

Monday, February 11th 2008, 12:14pm

Link to download RPM

You can download the packages from:

http://www.oesf.org/index.php?title=Downloads

Also one thing I want to know ???

Did u follow the same instruction as suggested in www.kevinboone.com site or some other method to install packages ??

Thanks
  • Go to the top of the page

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

8

Tuesday, February 12th 2008, 5:10am

RE: Link to download RPM

Hello,
thanks for the link.Actually I hadnot downloaded the packages you mentioned since I thought I could compile with arm-linux-gcc which I alredy have installed on my system.

Now I have downloaded the four packages from the link you had suggested.
I use the following procedure for installation

[root@localhost /]# cd root
[root@localhost ~]# rpm -i gcc-cross-sa1100-2.95.2-0.i386.rpm
[root@localhost ~]# rpm -i binutils-cross-arm-2.11.2-0.i386.rpm
[root@localhost ~]# rpm -i glibc-arm-2.2.2-0.i386.rpm
error: unpacking of archive failed on file /opt/Embedix/tools/arm-linux/lib/gconv/IBM939.so;47b1703f: cpio: read
[root@localhost ~]# rpm -i linux-headers-arm-sa1100-2.4.6-3.i386.rpm
[root@localhost ~]#

You would have already guessed my next hurdle...I am facing problem while installing glbc-arm-2.2.2-0.i386.rpm.This is the error I face:
error: unpacking of archive failed on file /opt/Embedix/tools/arm-linux/lib/gconv/IBM939.so;47b1703f: cpio: read

what could be the problem?I have arm-linux-gcc installed at /usr/local/arm/3.3.2.Is it creating any conflicting problem?

thanks,
Ramandeep
  • Go to the top of the page

9

Tuesday, February 12th 2008, 6:03am

RE: RPM Download

Hi RamanDeep,

It there may be reason that the rpm u downloaded may be corrupted or you don't have enough disk space........check it
I was trying to attach the rpm but due to slow speed of net I was not able to upload it .
Try using different mirror.......

Thanks
  • Go to the top of the page

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

10

Tuesday, February 12th 2008, 6:25am

RE: RPM Download

Hello Mr. Bargi,
I downloaded the file again and luckily it has installed this time.Now I am able to compile the code hello2.cpp

#include <qmainwindow.h>
#include <qpe/qpeapplication.h>

int main(int argc, char** argv)
{
QPEApplication app(argc, argv);
QMainWindow* mainWindow = new QMainWindow();
mainWindow->setCaption("Hello, World!");
app.showMainWidget(mainWindow);
return app.exec();
}

It generated an executable hello2.I transferred the file to my arm9 board running on linux, changed the permissions there and executed the file there.It shows an error:

../hello2: error while loading shared libraries: libqte.so.2: cannot open shared object file: No such file or directory

What could be the problem?

Thanks,
Ramandeep

This post has been edited 1 times, last edit by "ramandeep" (Feb 12th 2008, 7:17am)

  • Go to the top of the page

11

Tuesday, February 12th 2008, 7:36am

RE:libqt.so.2

Hi,

It seems that libqt.so.2.3.1 file is not available.

Is there qt installed in your system ????????

You can check it in /usr/lib/ folder for name "qt".... or type command on konsole :

Quoted


whereis qt


It will show u the path....

I have upload a tar file which has this library.

Extract it to your /usr/lib folder and rename it as libqt.so.2.3.1 .

After that make a link named libqt.so.2 linking to libqt.so.2.3.1..........

This will solve your problem..........
Bargi has attached the following file:
  • libqt.txt.tar.bz2 (1.89 MB - 19 times downloaded - Last download: Jul 7th 2008, 10:47pm)

This post has been edited 2 times, last edit by "Bargi" (Feb 12th 2008, 7:58am)

  • Go to the top of the page

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

12

Tuesday, February 12th 2008, 8:48am

RE: RE:libqt.so.2

Thanks...
I checked my PC in the /usr/lib/ folder there is folder called qt-3.3.
If I am not wrong I am supposed to install this tar file on my PC(and not on the board)Please correct me if I am wrong.
Well assuming that I am correct I tried extracting the file in the /usr/lib/ location.I renamed the extracted file as libqt.so.2.3.1.
But how do I make a link named libqt.so.2 linking to libqt.so.2.3.1.
Please forgive me if this question is very basic but I cannot help asking this.

thanks,
ramandeep

This post has been edited 1 times, last edit by "ramandeep" (Feb 12th 2008, 9:09am)

  • Go to the top of the page

13

Tuesday, February 12th 2008, 9:17am

RE:libqt.so.2

Ok RamanDeep,

Follow the step one by one:

a) Extract the tar file where ever you want.

b) Rename the library as "libqt.so.2.3.1" (mind the dots)

c) Copy this file to /usr/lib/ folder. (Be sure your are copying as root otherwise it will not allow you to copy)

d) Right click the file and there will option make link. Click on that ,a bent arrow file will be created. Rename this as "libqt.so.2"

e) Now close all windows and start the application again..............

I hope this will work :)
  • Go to the top of the page

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

14

Tuesday, February 12th 2008, 9:42am

RE: RE:libqt.so.2

I untarred the tar file and placed the untarred file at /usr/lib/qt-3.3/lib .I created the link and placed it at /usr/lib/qt-3.3/lib .I still get the same error.
when I compile the file on my PC it compiles well and creates the executable hello2.then when I transfer the file on my board and execute the executable as:
./hello2
on the board I get the following error:
../hello2: error while loading shared libraries: libqte.so.2: cannot open shared object file: No such file or directory

I believe that when I compile this hello2.cpp it generates code for arm target.But when I execute it on the ARM9 board it gives the above error.
Do I need to install anything on the board?My board is running on ARM9 Linux.It has a TFT LCD connected to the VGA port.I need to display graphics on the LCD.It doesnt have qt installed.
thanks,
ramandeep
  • Go to the top of the page

15

Tuesday, February 12th 2008, 9:55am

RE: RE:libqt.so.2

Hi RamanDeep,

Read This line again :

Quoted


c) Copy this file to /usr/lib/ folder. (Be sure your are copying as root otherwise it will not allow you to copy)


You have to copy the file to /usr/lib folder and not in :

Quoted


/usr/lib/qt-3.3/lib


Correct it and run application again............
  • Go to the top of the page

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

16

Tuesday, February 12th 2008, 10:12am

RE: RE:libqt.so.2

Oh thanks for correcting me.
I created the link and placed it at /usr/lib/ folder.
But I still get the same error when I execute the hello2 executable on the board.

thanks,
ramandeep
  • Go to the top of the page

17

Tuesday, February 12th 2008, 10:26am

RE: RE:libqt.so.2

I think the previous attachment was not properly uploaded.............

Try this new one .........
Bargi has attached the following file:
  • Go to the top of the page

18

Tuesday, February 12th 2008, 10:26am

RE: RE:libqt.so.2

I think the previous attachment was not properly uploaded.............

Try this new one ......... I apologize for mistake :)
  • Go to the top of the page

19

Tuesday, February 12th 2008, 10:30am

RE: RE:libqt.so.2

Quoted

Originally posted by Bargi
Double post by mistake ignore this one...... :)
  • Go to the top of the page

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

20

Tuesday, February 12th 2008, 10:42am

RE: RE:libqt.so.2

Thanks.. no you dont need to apologize
I tried with this new one too...I am still stuck....
Do I need to install anything on the board?Because since it is compiling well on the PC I think everythings fine on the PC side.may be we need to check something on the board side?I dont know ...I am confused..

thanks
  • Go to the top of the page

Rate this thread