Some people like to develop Pi code on the Pi itself. Some people like to develop on the PC and cross-compile for the Pi. With Qt there is a third option:
Using qtcreator you can develop your program on a PC or Mac using whatever OS you have there. Get it working and tested as a Windows or whatever application. When it is in good shape copy the source code to your Pi and build it there using the qt command line tools:
Code: Select all
$ cd myProject
$ qmake -o Makefile myProject.pro
$ make
That is fine for the GUI stuff, file handling, networking, threading etc but if you program makes use of Pi specific features, GPIO, PWM, etc, that are not available on the PC you have a problem.
The solution to that is to create "mock" classes/functions that simulate the Pi features. These enable building and testing of your Qt program on the PC.
Meanwhile the real versions of those classes/functions can be developed and tested on the Pi itself without using qtcreator or even any qt at all.
Memory in C++ is a leaky abstraction .