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:
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.
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. 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 section 2.8 Install trouble-shooting 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>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.
Next: 2.8 Install Trouble-shooting Up: 2. Installing SDCC Previous: 2.6 Reading the Documentation Contents Index 2008-02-29 |