Using QtMobility in QtCreator: Setup? - c++

I am trying to set up a development environment to play around with developing Qt apps for Symbian devices. I have succesfully set up the environment and am able to create simple apps such as HelloWorld and get them to run on my device. I would now like to try using the QtMobility package, but I am struggling to get it to work in QtCreator.
I got some sample code for using the camera (initially I only had QtMobility 1.0.2, but I have now downloaded the 1.1.0 technology preview version). I followed the instructions in the help file to install it, here is what I did:
Extracted the zip file to C:\QtMobility
Opened a Qt Command prompt and ran configure (in the QtMobility directory)
Ran mingw32-make
Ran mingw32-make install
Finally I updated my PATH variable to include C:\QtMobility\lib
I went back to QtCreator (restarted it) and looked at the cpp file that first calls the macro QTM_USE_NAMESPACE but it is still underlined in red, because it can't find the qmobilityglobal.h file.
Does anyone know if I have missed anything out during the installation that will tell the QtCreator where to find the QtMobility header files?

mingw32-make suggests you're building for win32-mingw target environment. To work with Symbian SDKs, you should be building for e.g. symbian-abld instead. The configure.bat script will auto-detect the target you are building for. Just make sure that QT_PATH environment variable points to a location where you have a Symbian build of the Qt toolchain.
(Also note that make install is unnecessary with symbian-abld - the build step already puts everything in place in Symbian SDK directories.)

Related

Cannot Run Compiler 'cl' for qt5.10.1 on Windows 10 in terminal

I have never used qt before, but I got a task to build an already existing application for Windows and Mac using the newest version of qt. What I have done so far is:
Installed Visual Studio Professional 2017.
Installed the latest Qt 5 Open Source.
Note: when installing the QT 5 I installed all of the components under QT/ QT 5.10.1 which were: qt 5.10.1 components and under QT/Tools I installed QT Creator 4.6.0 CDB Debugger Support and MinGW 5.3.0 : qt 5 Tools
I cloned the branch from GitHub that I wanted to build to C:/Projects
Then in Git Bash I cd to the project and tried to run qmake. The first time I had this problem:
"bash: qmake: command not found"
After searching into the problem I found out that I haven't added "Qt/5.10.1/msvc2017_64/bin" to PATH and I added it. Now when I echo $PATH I can see the directory added.
Now after bash recognises qmake and I try to run it it says:
Project ERROR: Cannot run target compiler 'cl'. Output:
===================
Maybe you forgot to setup the environment?
I have no idea how to fix the problem due to the fact that I have never used QT to build anything before. Can you help me?
In the read me file for the application I am trying to build it says:
Step-by-step instructions
1. Clone this branch
2. cd into the project
3. Run qmake - this wil generate Makefiles for all of the project's modules
4.Run make (Use the -j4 of -j flags - this greatly speeds up the build process - see the manual page for make for more info). You can also use the -s flag to silence the output - this also wins you a few seconds.
I am a bit puzzled by the instructions, it does not say to run qmake -project anywhere, but there is a qt project file in the directory that I cd to. Does this mean that I don't have to run qmake -project?
Also I have no idea how to run make by using the -j4 and -j flags and how to run flags in general. Could someone help me?
I believe that for the Cannot Run Compiler 'cl' issue I have some kind of a problem with the set up. Did I install too many components or is it to do with the VS setup?
I highly recommend you to install Qt from the Qt installer, and to use Qt Creator.
However, if you want to use it from source, you first need to get a compiler (ex: MinGW). Then you need to execute the instructions, but you need to use a MinGW (or whatever compiler you use) command prompt, which will automatically set the environment variables needed.
Note that this is Windows specific. On mac and linux, the compiler's environment variables are already set in the default command prompt (if there is a compiler, obviously).

svn - wrong version for Qt Creator on OS x

In my code I need to display the svn version of my project...
The project was created in Windows and uses svn version 1.8.10
On OS X 910.9) the installed version for svn was 1.7.9 so I had to upgrade it.
I got 1.8.10, and checking from the terminal, it shows that.
I added the installed directory for svn to the path. The "set" command now shows
PATH=/opt/subversion/bin:/usr/bin:....
But.... From Qt Creator, I am still unable to use svn:
svn: E155021: This client is too old to work with he working copy at '/path_to_project_folder' (format 31).
You need to get a newer Subversion client. For more details, see http://subversion.apache.org/faq.html#working-copy-format-change
The command '/usr/bin/svn' terminated with exit code 1.
So... it seems that Qt Creator (and the command I call from the project file) uses the old path for svn...
The work-around for now is to hard-code the full path to svn in the pro file (the command that gets the version)
But... How can I get Qt to work with the correct svn version without having to hard-code the path in program ?
I found the Environment section in Qt Creator - which uses its own PATH... doesn't seem to get updated with updates on system PATH but I was able to add to it manually

Unable to build for Windows on Linux, with MinGW

Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.

`Configure` in Qt 5.0.1 is not recognized

I've downloaded Qt 5.0.1 for Windows 32-bit (MinGW) and want to configure it again to support OpenSSL, but I can't find confiure.exe.
By the way, when I use Qt 5.0.1 command prompt to use configure, it says "configure.exe is not recognized".
configure.exe is part of the Qt's source code - so make sure you installed that.
But anyway i recommend you download the source code from here and start in a separate folder if you want to build Qt yourself (if you download the source make sure that you get the .zip from downloads, tar.gz is for linux use and doesn't have the Windows configure.exe)

Stepping into Qt sources in Qt Creator (in Ubuntu Linux)

I'm using Qt Creator in Ubuntu. It's installed from the repositories but as it is now, there is no way to step into the Qt sources when debugging.
How can I enable that?
Since Qt Creator uses gdb, you need to configure gdb. First thing to do is to install Qt debugging symbols:
apt-get install libqt4-dbg
Or, for Qt5:
apt-get install qtbase5-dbg # For the qtbase package
This will install the debugging symbols for Qt libraries. Older releases of Ubuntu had a silly bug that required additional trick to correct those symbol files, but in the current release it works fine.
This will make gdb step inside Qt methods, but it's no fun without sources. So we need sources which can be installed like this, assuming that the source repository is enabled in the APT:
apt-get source qt4-x11
ln -s qt4-x11-4.7.0 qt # a convenience symlink
Or, for Qt5:
apt-get source qtbase-opensource-src
# Make a link as above, if you wish
This will download the sources, unpack them into the current directory and patch them accordingly, no root privileges needed unless the current dir isn't writeable by the current user.
And the last thing is to inform gdb of the sources location, which is done by putting this in the ~/.gdbinit file:
dir ~/vita/qt/src/corelib
dir ~/vita/qt/src/gui
dir ~/vita/qt/src/network
dir ~/vita/qt/src/sql
Add modules and correct paths as needed. The convenience symlink is very useful here, so we don't have to edit this file each time we upgrade to a new Qt version. We only need to download the new sources, patch them and change the symlink.
Note that even we have installed the debugging symbols, we still use the release build of Qt libraries. This means that the code is highly optimized and will sometimes behave very strange when stepping inside Qt binaries. If it is a problem, then it is necessary to build Qt in debug mode, install it separately (say, in /usr/local/qt4-debug) and tell Qt Creator to use that particular installation.
The only way i made it work on Ubuntu is building Qt from sources with configure -debug.
Everything started to work like a charm afterwards.
Qt binary packages for Linux don't contain debug symbols and therefore the debugger doesn't know files or line numbers where to jump to. You need to build Qt yourself with -debug configure option if you want to be able to debug Qt code.
Instructions from Sergey Tachenov instructions would only work if you build your application against the Qt version that you can find from Ubuntu repositories.