OK, by now, you should have everything installed and running and you have read a few docs. Let's compile the Hello World example together.
The Hello World example
We will first check that the SDK is correctly working:
Open a DOS box,
just type 'NMAKE' (without the quotes!), if you get a Microsoft Error message U1064, don't worry, this was just to check your path is correctly configured. If you have an error message saying that NMAKE is not a recognised command, you should run the VCVARS32.BAT script that is located in
C:\Program Files\Microsoft Visual Studio\VC98\Bin
Or modify your path so that it includes the path to Microsoft command line compilation tools).
From the DOS box, move to the HelloWorld example in
C:\Symbian\6.1\Series60\Epoc32Ex\Basics\HelloWorld
You should have three files in this directory (if not, check that you are in the correct example, they are several "Hello World" example and we will only consider the simplest one by now):
bld.inf
helloworld.mmp
helloworld.c
Bld.inf (Bld stands for Build) is the master project file. It generally contains the list of all makefiles (one for each component) that are part of the project. In our example, it only contain a reference to the helloworld.mmp makefile:
// BLD.INF
// Component description file
//
// Copyright (c) 2000 Symbian Ltd. All rights reserved.
PRJ_MMPFILES
HelloWorld.mmp
Helloworld.mmp is the project makefile. It contain the list of all source files and libraries that are part of the component:
// HelloWorld.mmp
//
// Copyright (c) 2000 Symbian Ltd. All rights reserved.
// using relative paths for sourcepath and user includes
TARGET HelloWorld.exe // The name of the target
TARGETTYPE exe // The type of the target
UID 0 // The Unique Identifier of the target
// ------------------------------------------------
// The source files
// ------------------------------------------------
// The relative path to the source files
SOURCEPATH .
// The list of source files
// (add as many statements as you need)
SOURCE HelloWorld.cpp
// ------------------------------------------------
// The includes files
// ------------------------------------------------
// Path to user include files (#include "file")
// (add as many statements as you need)
USERINCLUDE .
USERINCLUDE ..\CommonFramework
// Path to system include files (#include <file>)
// (add as many statements as you need)
SYSTEMINCLUDE \Epoc32\include
// ------------------------------------------------
// The libraries to link against
// ------------------------------------------------
// List of libraries you will use in your app
// (add as many statements as you need)
LIBRARY euser.lib
And last but not least, Helloworld.cpp is the C++ code which is quite self explanatory:
// HelloWorld.cpp
//
// Copyright (c) 2000 Symbian Ltd. All rights reserved.
#include "CommonFramework.h"
// do the example
LOCAL_C void doExampleL()
{
_LIT(KHelloWorldText,"Hello world!\n");
console->Printf(KHelloWorldText);
}
The CommonFramework.h is a useful header file that set up a basic console environment and calls a doExampleL() primitive: this is an extremely useful file to begin playing Symbian C++ without the burden of NS60 specific code (you can also read A simple text console if you want to know more about this console).
Command line compilation
In the DOS box, type
bldmake bldfiles
You should not have any output on screen but a new file called ABLD.BAT has been created in the project directory. This is the entry point to the Perl script that is used to compile the application.
Now, we can compile our application. Type
abld build wins udeb
You should get a long and cryptic output describing the compilation.
However, you will notice that nothing as been created in the current project directory. Welcome to the wonderful world of Symbian. As a matter of fact, you cannot specify where the result of the compilation process will be stored. Let's go to:
C:\Symbian\6.1\Series60\Epoc32\Release\wins\UDEB
The Helloworld.exe is there. Not very convenient. Type Helloworld and you should see the epoc emulator starting the "Hello world" application.
Working with Visual C++
If you are not a command line addict (which is probably your case since you are using Windows), you can also use Visual C++ to compile and execute your application.
Go back to
C:\Symbian\6.1\Series60\Epoc32Ex\Basics\HelloWorld
The abld command generates a Visual C++ workspace:
abld makefile vc6
Once again, it is not located in the project directory. This time you will find it in
C:\Symbian\ 6.1\ Series60\ Epoc32\ BUILD\ SYMBIAN\ 6.1\ SERIES60\ EPOC32EX\ BASICS\ HELLOWORLD\ HELLOWORLD\ WINS
Open the workspace. Recompile and start your application using CTRL-F5. This will regenerate the Helloworld.exe file and start the emulator. You can also set some breakpoint and use the Microsoft debugger if you need to debug an application (maybe not with this example since there is not so many lines to debug!).
Target compilation
You may now want to compile this example to run it on your phone. Unfortunately, you cannot do that directly from Visual C++. Go back your DOS box, in the Go back to
C:\Symbian\6.1\Series60\Epoc32Ex\Basics\HelloWorld
Use the abld build command to compile but specify the THUMB or ARMI target:
abld build thumb urel
As usual, the result of the compilation is not in the project directory but in C:\Symbian\6.1\Series60\Epoc32\Release\thumb\UREL
Locate the Helloworld.exe file in this directory and send it over Bluetooth or Infrared to your phone:
enable Bluetooth or Infrared on your mobile,
move it so that it can connect to your PC,
right click on the exe file,
select Send To/Infrared (or Bluetooth)
Read Starting APP and EXE applications to check how to start the exe application.
Here it is. You should now be able to compile and run most of the basic examples found in the SDK directories. You can also take a look at the Overview of the Compilation system to know a little bit more on the ABLD command.
:<: Part II
> Getting Started with Symbian development (Part III)
Hi:
I'm new in this environment... My problem is - 'abld' not running at the command prompt... I tested my installation by creating a default project (thru wizard) in VC6 and it's compiled, linked & run (debug) without any problem... What may be the cause? Is there any other way I can create a VC6 workspace without running 'abld'.
Thanks
Partha
> Getting Started with Symbian development (Part III)
> Getting Started with Symbian development (Part III)
Hi Eric:
Actually there are two problems one you mentioned and other one is the PATHTEXT - I added .pl there manually.
Evrything was there in the manual/ help files - I should read those well - before asking for help... I'm sorry... Anyway thanks for your help.
Thanks
Partha
> Getting Started with Symbian development (Part III)
Excellent Tutorial!
can't execute bldmake bldfiles
hi all,
after goin thru this article, i followed the step by step guide. however, when i type 'nmake' the not recognizable command error occured n i ran the .bat file as instructed but it cant seem to solve the prob. after that, when i type 'bldmake bldfiles'... it generates error which look something like this:
"BLDMAKE ERROR: ERROR: CPP executable not found in path. BEGIN failed--compilation aborted at C:\Symbian\6.1\Shared\Epoc32Ex\Tools\/Checkgcc.pm line 34...... n some other similar errors"
izit something to do with the symbian sdk software? i tried to uninstall n reinstall it but the prob is my laptop hangs while the uninstallation took place.
anybody can help??? tx in advance. =)
> can't execute bldmake bldfiles
The Microsoft Commend line tools are not visible in your path. Try to locate the VCVARS32.BAT file in the Microsoft Studio installation path and run it before doing the BLDMAKE BLDFILES.
Alternatively, check how it modifies your PATH and update it from the system configuration panel so that you don't have to run it each time.
> can't execute bldmake bldfiles
Hi there, I too started probably the same way you did. And obviously, as you might have guessed, i too ended with the same error. I was getting the error when i tried to execute bldmake bldfiles, the error was
"BLDMAKE ERROR: ERROR: CPP executable not found in path. BEGIN failed--compilation aborted at C:\Symbian\6.1\Shared\Epoc32Ex\Tools\/Checkgcc.pm line 34...... n some other similar errors"
I tried to figure that out. And what i found was, in CheckGcc.pm file, a function named CheckGCC_Default() is looking out for an application named as CPP.EXE or CPP.BAT or CPP.CMD. And for this purpose it checks all the mentioned paths in Environment variable PATH.
The solution is we need to add the path of CPP.EXE into the Environment variable PATH. On my system it was in the "C:\Symbian\8.0a\S60_2nd_FP2\epoc32\gcc\bin". The path on your system where it exists might be different, but it would certainly be in gcc\bin folder to my knowledge. Add that in the PATH variable. It actually worked for me. You can try your luck. :-)
One more thing i did which i would like to mention is, i executed VCVARS32 from command prompt and what all changes are done to the PATH variable, i added them manually through "My Computer->properties ->Advanced tab". This i did as i dont need to execute VCVAR32 each time i try to use command promt. For clarity sake i added my Path variable content here. Customize it accordingly for your system folders.
PATH = c:\Perl\bin;C:\Symbian\8.0a\S60_2nd_FP2\epoc32\gcc\bin;C:\Symbian\8.0a\S60_2nd_FP2\epoc32\tools;C:\PROGRA~1\MICROS~3\Common\msdev98\BIN;C:\PROGRA~1\MICROS~3\VC98\BIN;C:\PROGRA~1\MICROS~3\Common\TOOLS\WINNT;C:\PROGRA~1\MICROS~3\Common\TOOLS;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\lotus\notes;C:\RPFolders\SW\Lotus Notes\notescpp\lib\mswin32;C:\RPFolders\SW\Lotus Notes\notescpp\notedata;.;
Hope this helps.
problems with ABLD
Hi there,
I have encountered 2 problems running the abld part of this exercise.
The First was a pile of error starting with file not found due to a "\\" in the path. This I fixed by editing the ABLD.BAT file. I replaced the line
perl -S ABLD.PL "\SYMBIAN\7.0S\SERIES60_V21\EXAMPLES\BASICS\HELLOWORLD\\" %1 %2 % 3 %4 %5 %6 %7 %8 %9
with perl -S ABLD.PL "\SYMBIAN\7.0S\SERIES60_V21\EXAMPLES\BASICS\HELLOWORLD\" %1 %2 % 3 %4 %5 %6 %7 %8 %9
This seemed to get rid of that error. However Then I came across the following error output which I do not understand
C:\Symbian\7.0s\SERIES~1\Examples\basics\HELLOW~1>abld build wins udeb ABLD ERROR: "\Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\E XAMPLES\BASICS\HELLOWORLD build wins udeb Platform.pm" not yet created BEGIN failed--compilation aborted at C:\Symbian\7.0s\Series60_v21\epoc32\tools\a bld.pl line 144.
> problems with ABLD
> problems with ABLD
no exe file exist
exe vs. app files
This tutorial is based on antoher helloworld example -> there are two helloworld examples in the SDK:)
When you get the *.app file as a result (the target file: app or exe is specified in .mmp file) run the emulator ('epoc' in the console) and then if everything was set up correctly it should appear among other installed applications (in my version in appears in the main menu, but it can be located in the AppMan folder)
Cheers
Tym
> Getting Started with Symbian development (Part III)
> no exe file exist
hi,
after typing 'abld build thumb urel', you will find a *.app file in 'C:\Symbian\6.1\Series60\Epoc32\Release\thumb\UREL'.
i don't know why there should be a *.exe file .. your phone cannot execute it.
my nokia 6600 needs a *.sis file. to get such a file, change to the directory of your project (e.g. helloworld), that contains the *.pkg file (e.g. helloworld.pkg). it must be the \install directory .. using sdk 2.0 series60 it is \sis.
change to this file in the command line and type: 'makesis helloworld.pkg c:\symbian\...\helloworld\hello.sis'
now copy the *.sis file to your phone.
> Getting Started with Symbian development (Part III), same rake
Hi, I keep on stepping on the same rake over and over again. I mean, I've got 'EPOCROOT environment variable must be capitalised' :( In my case I set it as system level environment variable (EPOCROOT=\Symbian\8.0a\S60_2nd_FP2\) and reboot machine. After that error I also have:
BEGIN failed--compilation aborted at C:\Symbian\8.0a\S60_2nd_FP2\epoc32\tools\/E 32env.pm line 51. Compilation failed in require at C:\Symbian\8.0a\S60_2nd_FP2\epoc32\tools\bldmak e.pl line 29. BEGIN failed--compilation aborted at C:\Symbian\8.0a\S60_2nd_FP2\epoc32\tools\bl dmake.pl line 29.
Is it because of EPOCROOT or something else ?