GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 16-Sep-2009, 18:09
mfmikula mfmikula is offline
Awaiting Email Confirmation
 
Join Date: Sep 2009
Posts: 1
mfmikula is on a distinguished road

Beginner's Qt/embedded compiling problem


******Hello, all. When I try to make the Qt embedded examples, most of the "makes" fail with numerous errors. The only two examples I have made successfully are buttongroups and popup.

******I am trying to develop on a TS-7300 ARM cpu running kernel 2.4.26-ts11. I configured: ./configure -qconfig small. Everything "made" successfully until the first example was compiled.

******Here are the first 10 errors from the make of “checklists”:
Code:
checklists.cpp: In constructor `CheckLists::CheckLists(QWidget*, const char*)': checklists.cpp:41: error: invalid use of undefined type `struct QListView' checklists.h:16: error: forward declaration of `struct QListView' checklists.cpp:42: error: no matching function for call to `QVBoxLayout:: addWidget(QListView*&)' ../../include/qlayout.h:386: error: candidates are: void QBoxLayout::addWidget(QWidget*, int, int) checklists.cpp:43: error: `addColumn' undeclared (first use this function) checklists.cpp:43: error: (Each undeclared identifier is reported only once for each function it appears in.) checklists.cpp:44: error: `setRootIsDecorated' undeclared (first use this function) checklists.cpp:47: error: `QListViewItem' undeclared (first use this function) check

****** excerpt from checklists.cpp:
CPP / C++ / C Code:
#include <qlistview.h>
#include <qvbox.h>
#include <qlabel.h>
#include <qvaluelist.h>
#include <qstring.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include "checklists.h"

.
.
.

    lv1 = new QListView( this );			// line 41
    vbox1->addWidget( lv1 );
    lv1->addColumn( "Items" );
    lv1->setRootIsDecorated( TRUE );

    // create a list with 4 ListViewItems which will be parent items of other Li
stViewItems
    QValueList<QListViewItem *> parentList;

****** excerpt from checklists.h:
CPP / C++ / C Code:
#ifndef CHECKLISTS_H
#define CHECKLISTS_H

#include <qwidget.h>

class QListView;				// line 16
class QLabel;

class CheckLists : public QWidget
{
    Q_OBJECT

****** this is what make is attempting to do:
Code:
root@ts7000:checklists# make g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -O2 -DQT_NO_DEBUG -DQT_SHARED -I/u sr/local/qt-embedded-free-3.3.4/mkspecs/qws/linux-generic-g++ -I. -I. -I../../in clude -I.moc/release-shared-emb-generic/ -o .obj/release-shared-emb-generic/chec klists.o checklists.cpp
****** this is my ln to g++:

root@ts7000:examples# ll /usr/bin/g++
lrwxrwxrwx 1 root root 7 Sep 14 19:20 /usr/bin/g++ -> g++-3.3*

****** I am using Qt/embedded 3.3.4 and this version of g++:
root@ts7000:examples# g++ -dumpversion
3.3.5

****** qlistview.h exists in two places ( but the first links to the second):

root@ts7000:checklists# find / -name qlistview.h
/usr/local/qt-embedded-free-3.3.4/src/widgets/qlistview.h
/usr/local/qt-embedded-free-3.3.4/include/qlistview.h

****** this is the output of “env”

HOME=/root
LOGNAME=root
_=/usr/bin/env
root@ts7000:checklists# env | more
HZ=100
SHELL=/bin/bash
TERM=vt100
HUSHLOGIN=FALSE
QTDIR=/usr/local/qt-embedded-free-3.3.4
OLDPWD=/usr/local/qt-embedded-free-3.3.4/examples
USER=root
LD_LIBRARY_PATH=/usr/local/qt-embedded-free-3.3.4/lib
QTDIR2=/usr/local/qt-embedded-free-3.3.4
MAIL=/var/mail/root
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/qt-embedded-free-3
.3.4/bin
PWD=/usr/local/qt-embedded-free-3.3.4/examples/checklists
PS1=\u@\h:\W#
SHLVL=1
HOME=/root
LOGNAME=root
_=/usr/bin/env


******Thanks in advance for any help - I'll gladly take embarassment over hopelessness.
Last edited by LuciWiz : 16-Sep-2009 at 18:27. Reason: Please insert your C++ code between [cpp] & [/cpp] tags
  #2  
Old 17-Sep-2009, 11:13
Mexican Bob's Avatar
Mexican Bob Mexican Bob is offline
Regular Member
 
Join Date: Mar 2008
Location: Chicxulub, Yucatán
Posts: 342
Mexican Bob is a jewel in the roughMexican Bob is a jewel in the roughMexican Bob is a jewel in the roughMexican Bob is a jewel in the rough

Re: Beginner's Qt/embedded compiling problem


I use Qt extensively. You appear to be having an issue with your understanding of how Qt does its business.

You will want to create a .pro file for your Qt projects. Start by taking an example Qt project file and using it.

Once you have a .pro file for your project, you will want to execute qmake on it. The qmake executable will create a Makefile for your project, with which you can use gmake (usually aliased or named make on most Linux-based systems) to compile and link your executable.

I'd recommend that you start with a very simple project that does nothing more than instantiates a QMessageBox with some "Hello World" type text in it. Once you can successfully build and execute it on your x86-based machine, then you may want to consider what efforts it takes for you to deploy to your embedded target.

Now, there are a few nuances that you *must* understand in order to effectively use Qt.

You must have built the Qt libraries for your target execution environment.

This is an imperative. You can not expect x86 compilers to produce object code that will run on an ARM. What you need to do is to ensure that you have a working cross compilation environment configured for your target and that it is in your PATH environment variable.

Once you have a target compilation environment and can write a simple C++-based hello world app and execute it on your target platform, you are ready to build Qt for the target.

If there is already an existing Qt "port" for your target, you are well ahead of the game. Otherwise, you'll want to create your own <qt_install_dir>/mkspecs/qws directory and related files.

I recommend that you copy an existing architecture directory that is fairly similar to your own. However, linux-arm-g++ may be sufficient. Read the qmake.conf file inside of that directory to see if it meets the needs of your cross compiler arguments. If it doesn't, I recommend that you create a copy of the similar one and rename the directory to something that denotes your architecture and then make the modifications needed to qmake.conf.

Once you have qmake.conf right for your architecture, you're ready to start.

Building Qt is a three phase endeavor. Actually, there are several phases, but there are probably only three that are of the most importance to you.

1: configure
2: make (qmake and other binary tools that run on the x86)
3: make for your target architecture


If you have not already built Qt for your x86, please do that first.

Start by freshly extracting the tarball to a new directory location. Enter the directory and execute the configure script as follows:

$ ./configure -prefix /usr/local/qt-emb-x86-3.3.4

I recommend using the defaults for now. When you gain more understanding, you will be ready to use more "features" of configure to custom tailor your Qt builds.

When configure completes, run make (use -j8 if you have a fast dual core machine) and then (as root) make install

When you have a complete installation, modify your QTDIR environment variable to point to /usr/local/qt-emb-x86-3.3.4 and then add $QTDIR/bin to your $PATH.

At that point, you are ready to consider cross configuring Qt. However, I'd probably recommend that you wait until after you have been able to write your own Qt-based hello app and can build and execute it on x86.

Building a new Qt-based app is really just the following steps:

1: create a new project directory
2: create a new .pro project file
3: create your source files
4: add your source files and related project details to your .pro file
5: run qmake
6: run make
7: debug/test your app

Get so where you know and understand each of these steps as a bare minimum. If you were able to do these steps, we wouldn't be seeing the junk coming from your screen. You need to have complete confidence in these steps before you're ready to do any work on an embedded target platform. It gets harder, not easier when you move from something with which many people feel confident (their own computers) to "devices." Those devices are complete little, self-contained worlds of their own. Every step that you take that gets you closer to them gets a bit more challenging and is a learning curve that you'll have to complete before you're ready for the next step. Read and use the Qt reference documentation. It is very substantial, but tends to assume more knowledge as you get more into the embedded side of things.



MxB
 
 

Recent GIDBlogVista ?Widgets? on Windows XP by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cout problem on compiling Golmal C++ Forum 1 17-Jan-2008 06:59
Problem compiling MFC program shvalb MS Visual C++ / MFC Forum 1 21-Sep-2006 20:14
Problem compiling a program, my first vector. george89 C++ Forum 2 26-Jun-2006 21:10
Problem compiling GMP code Bruno Couto C Programming Language 2 07-Oct-2005 09:40
Compiling problem, please help. os008 C++ Forum 6 06-Feb-2005 09:02

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:31.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.