PDA

View Full Version : qt creator and cross compiler



RAI32
18th January 2012, 10:44
HI, is my first time using qt creator and I need to create a graphical interface to use in an Arm 11 board.
I have installed in my Linux (Debian) the cross compiler and the arm-linux-gcc to compile my projects but my main problem is that I don't understand to configure the qt creator to compile using the cross compiler or arm-linux-gcc libreries.
I red about qmake, cmake... but I don't know somethnig about this.
I don't know if I have to reference the lib's, include's in the qt creator or if I have to put the ref's in the command line when I try to compile.
Could somebdy explain me how to configure the qt creatorto compile the projects using cross compile and how to compile the projects?
I red a lot of information but I don't understand because I'm very inexpert.
Thanks very much.

I find the Makefile in a project,
CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I.
LINK = g++

and I edit this Makefile changing:

CC = /usr/local/arm/4.3.2/bin/arm-linux-gcc
CXX = /usr/local/arm/4.3.2/bin/arm-linux-g++
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I.
LINK = /usr/local/arm/4.3.2/bin/arm-linux-g++


and when I run make, the error output is:
make: arm-linux-g++: Program not found

ChrisW67
18th January 2012, 21:35
and when I run make, the error output is:
make: arm-linux-g++: Program not found
Which part of that error message is not clear? If the specified compiler cannot be found, or cannot be run, then you will not get far.

Qt Creator simply runs qmake (or cmake) and then runs make. It is qmake that builds the Makefile. Have you built a version of Qt for embedded use? The qmake in that version should generate reasonable Makefiles and all you should have to do in Qt Creator is tell it to use that version of Qt.

RAI32
19th January 2012, 08:10
Hi ChrisW67, first of all, thanks very much for your reply.
I'm using a Debian distribution Linux and the Qt I'm using is the Qt installed by synaptic. I don't know if this Qt creator is the rigth way to develop software for an Arm embedded board. May be I need to use a Qtopia or a Qt4 embedded, but I don't know if those programs are the best option for my linux 2.6.36 and its rootfilesystems installed on the arm11 board.
I searched in the web about my erros and I found any solutions. I saw that I have to modify the mkspecs, but I don't know the changes I have to do to compile the program with my cross compiler version.
I made a qmake to create the Makefile and I modify this Makefile as show:


####### Compiler, tools and options

CC = /usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-gcc (modify to compile with my cross compiler)
CXX = /usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-g++ (modify to compile with my cross compiler)
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I.
LINK = /usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-g++ (modify to compile with my cross compiler)

Now the compiler is found but there are a lot of errors:
calculatorform.cpp: In constructor 'CalculatorForm::CalculatorForm(QWidget*)':
calculatorform.cpp:53: error: 'QUiLoader' was not declared in this scope
calculatorform.cpp:53: error: expected `;' before 'loader'
calculatorform.cpp:55: error: 'QFile' was not declared in this scope
calculatorform.cpp:55: error: expected `;' before 'file'
calculatorform.cpp:56: error: 'file' was not declared in this scope
calculatorform.cpp:56: error: 'QFile' is not a class or namespace
calculatorform.cpp:57: error: 'loader' was not declared in this scope
calculatorform.cpp:72: error: 'QVBoxLayout' was not declared in this scope
calculatorform.cpp:72: error: expected type-specifier before 'QVBoxLayout'
calculatorform.cpp:72: error: expected `;' before 'QVBoxLayout'
calculatorform.cpp:73: error: invalid use of member (did you forget the '&' ?)
calculatorform.cpp:73: error: base operand of '->' is not a pointer
calculatorform.cpp:74: error: no matching function for call to 'CalculatorForm::setLayout(<unresolved overloaded function type>)'
/usr/include/qt4/QtGui/qwidget.h:544: note: candidates are: void QWidget::setLayout(QLayout*)
.
.
.
I don't know how to configure the qt creator to take into account the includes and lib's availables in the linux 2.6.36 filesystems directories presents in the arm 11 board.