Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/09/06 06:05
Modified:
  05/09/06 07:30

Read: times


 
#115842 - linking multiple files
Responding to: ???'s previous message
SDCC can compile only ONE file at a time. Let us for
example assume that you have a project containing the
following files:

foo1.c (contains some functions)
foo2.c (contains some more functions)
foomain.c (contains more functions and the function main)

The first two files will need to be compiled separately
with the commands:

sdcc -c foo1.c
sdcc -c foo2.c

Then compile the source file containing the main()
function and link the files together with the following
command:

sdcc foomain.c foo1.rel foo2.rel

Alternatively, foomain.c can be separately compiled as
well:

sdcc -c foomain.c
sdcc foomain.rel foo1.rel foo2.rel

The file containing the main() function must be the
first file specified in the command line, since the
linkage editor processes file in the order they are
presented to it. The linker is invoked from SDCC using
a script file with extension .lnk. You can view this
file to troubleshoot linking problems such as those
arising from missing libraries.

The no-peep switch simply switches off the peep hole optimiation which is one of the last stages rather than turning off all optimisations.I suggest reading the manual section on multiple source file projects and on the optimisation routines.

List of 21 messages in thread
TopicAuthorDate
Linker problem using SDCC            01/01/70 00:00      
   Linker???            01/01/70 00:00      
      Linker!            01/01/70 00:00      
   I doubt SDCC would do that            01/01/70 00:00      
      Ok not the linker?            01/01/70 00:00      
         Sorry forgot to mention that I am using            01/01/70 00:00      
         Compiler & Linker            01/01/70 00:00      
         Nothing linked            01/01/70 00:00      
            SDCC File types            01/01/70 00:00      
            Linker problem            01/01/70 00:00      
               Then what is the problem?            01/01/70 00:00      
                  Simulator only sees the "main" program            01/01/70 00:00      
                     simulator and/or IDE problem?            01/01/70 00:00      
   Maybe this will illustrate ...            01/01/70 00:00      
      BiPOM says            01/01/70 00:00      
         SDCC new release?            01/01/70 00:00      
            Q2            01/01/70 00:00      
               SDCC new Release Q2 -            01/01/70 00:00      
   where is this code?            01/01/70 00:00      
      I used --no-peep SDCC            01/01/70 00:00      
         linking multiple files            01/01/70 00:00      

Back to Subject List