This article describes how to compile nearly the same code for Symbian S60 and Linux without making a change to the code.
The same should apply for Windows, but I didn't try yet.

To get started you should have read my article or the manual of Anderson Lizardo.

Additionally to these manuals I added three commands to my ~/.bashrc, though I don't have to set the environment variables every time.

{c}export PATH=/home/USER/gnupoc/bin:/home/USER/gnupoc/qt-4.6.1/bin:$PATH
export EPOCROOT=/home/USER/gnupoc/symbian-sdks/5.0/ # trailing "/" is required!{/c}

Symbian

In order to compile your code for Symbian you only have to change to the project directory, execute qmake and make debug-gcce.

{c}qmake
make debug-gcce{/c}

If you want to clean the source directory just enter make distclean.
{c}make distclean{/c}

Linux

Assumed you have installed the latest Qt Developer packets for Linux you are now able to compile the same source code for Linux.

It is important to execute qmake in order to generate the make files for Linux!
Now you can use the same commands as always to compile.
{c}qmake-qt4
make all
make clean{/c}

 

Generally you should have the installed the same Qt Versions for Symbian and for Linux. For example Qt 4.6.1 for Symbian and Linux.

If you want to or have to use different slight different versions, you should use only commands having identical behaviour in both versions.

FaLang translation system by Faboba