Hi

I am trying to compile and run my prog3.c program, but I am getting the compiler errors below. I have tried to reference the information by doing #include "node0.c" etc., but no luck. Any ideas on how to fix this problem? I attached the files below that I am working with. prog3.c is suppose to be the main simulator file. I am using DevC++ software. Any help is appreciated.


[Linker error] undefined reference to `rtupdate0'
[Linker error] undefined reference to `rtupdate1'
[Linker error] undefined reference to `rtupdate2'
[Linker error] undefined reference to `rtupdate3'
[Linker error] undefined reference to `linkhandler0'
[Linker error] undefined reference to `linkhandler1'
[Linker error] undefined reference to `linkhandler0'
[Linker error] undefined reference to `linkhandler1'
[Linker error] undefined reference to `rtinit0'
[Linker error] undefined reference to `rtinit1'
etc.

I just saw that this post should of went to the "C forum"..sorry

This is just a simple multi-file program. The big advantage of this [Particularly for big projects] is that you don't have to keep recompiling all the program in one go, just the bit that you are changing.

Although it doesn't do anything you can compile it like this:
(as individual files) [This creates a set of object files: node0.o node1.o etc]

gcc -c node0.c 
gcc -c node1.c
gcc -c node2.c 
gcc -c node3.c 
gcc -c prog3.c

Then you link like this gcc -o myprogram prog3.o node0.o node1.o node2.o node3.o which will give you a program called myprogram.

However, you can do it all in one line: gcc -o myprogram prog3.c node0.c node1.c node2.c node3.c If you have another compiler, then you have to combine all the files into one project.

Additional: Note that exit(int) which is used in your code is in stdlib.h although some compilers link to stdio.h as well. gcc is not one of them so you have to add #include <stdlib.h> to top of your prog3.c file.