On Wed, Feb 4, 2009 at 2:49 PM, William Ramsay <[email protected]> wrote: > I put my list of files into a Makefile using the same code you gave below. > Make runs through each file and compiles it to an object file with no > problem at all. However, when I try to link it all together with > csc -o foo a.o.b.o.c.o > > I get all sorts of errors for multiple definitions of C_toplevel and main. > > How do I get past that hurtle? >
Well, you mustn't forget that my advice is practically *always* incomplete and omits certain important details... It is for a reason that my academic record looks so bad. Of course you have to compile each file as "library units", to avoid exactly the problem that you've run into: the default compilation mode of chicken is to create a standalone executable. But we can't just link three standalone executables into another one (dumb linkers - what's so hard about it?). Please compile each file with "-unit <unitname>" or use "(declare (unit <unitname>))" in the mentioned files. The main program should then use these libraries with (declare (uses <unitname1> ...)) Note that the main module is not compiled as a unit. cheers, felix _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
