Next: 2.4 Install Trouble-shooting
Up: 2. Installation
Previous: 2.2 Windows Installation
  Contents
  Index
The first thing you should do after installing your SDCC compiler
is to see if it runs. Type "sdcc -version"
at the prompt, and the program should run and tell you the version.
If it doesn't run, or gives a message about not finding sdcc program,
then you need to check over your installation. Make sure that the
sdcc bin directory is in your executable search path defined by the
PATH environment setting (see the Trouble-shooting section for suggestions).
Make sure that the sdcc program is in the bin folder, if not perhaps
something did not install correctly.
SDCC binaries are commonly installed in a directory arrangement like
this:
/usr/local/bin |
Holds executables(sdcc, s51, aslink, ...) |
/usr/local/share/sdcc/lib |
Holds common C libraries |
/usr/local/share/sdcc/include |
Holds common C header files |
Make sure the compiler works on a very simple example. Type in the
following test.c program using your favorite editor:
int test(int t) {
return t+3;
}
Compile this using the following command: "sdcc
-c test.c". If all goes well, the compiler will generate
a test.asm and test.rel file. Congratulations, you've just compiled
your first program with SDCC. We used the -c option to tell SDCC not
to link the generated code, just to keep things simple for this step.
The next step is to try it with the linker. Type in "sdcc
test.c". If all goes well the compiler will link with the
libraries and produce a test.ihx output file. If this step fails (no
test.ihx, and the linker generates warnings), then the problem is
most likely that sdcc cannot find the /usr/local/share/sdcc/lib directory
(see the Install trouble-shooting section for suggestions).
The final test is to ensure sdcc can use the standard header files
and libraries. Edit test.c and change it to the following:
#include <string.h>
main() {
char str1[10];
strcpy(str1, "testing");
}
Compile this by typing "sdcc test.c".
This should generate a test.ihx output file, and it should give no
warnings such as not finding the string.h file. If it cannot find
the string.h file, then the problem is that sdcc cannot find the /usr/local/share/sdcc/include
directory (see the Install trouble-shooting section for suggestions).
Next: 2.4 Install Trouble-shooting
Up: 2. Installation
Previous: 2.2 Windows Installation
  Contents
  Index
Johan Knol
2001-07-13