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 output its version like:
SDCC : mcs51/z80/avr/ds390/pic16/pic14/ds400/hc08 2.5.6 #4169
(May 8 2006) (UNIX)
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 section 2.8 Install
trouble-shooting for suggestions). Make sure that the sdcc program
is in the bin folder, if not perhaps something did not install correctly.
SDCC is commonly installed as described in section ''Install and
search paths''.
Make sure the compiler works on a very simple example. Type in the
following test.c program using your favorite ASCII editor:
char test;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.
void main(void) {
test=0;
}
#include <string.h>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 section 2.8 Install trouble-shooting section for suggestions). Use option --print-search-dirs to find exactly where SDCC is looking for the include and lib files.
char str1[10];
void main(void) {
strcpy(str1, "testing");
}