PROS: "Undefined Reference to '<defined function>'"

@edjubuh

When using PROS, I have run into the following compiler error:


opcontrol.c:(.text.operatorControl+0x5a): undefined reference to `DriveDirect'
opcontrol.c:(.text.operatorControl+0xa8): undefined reference to `moveArm'

My research implies that I must include these files in the linker, but I do not see a way to do this with PROS, with the makefile. Advice? Help?

Where do you think you have those functions defined? Be sure that those functions are either declared in a header file that opcontrol.c uses or that the functions are defined in opcontrol.c. If you’re sure of that and


make clean all

(build the project from scratch) doesn’t resolve the issue, I can take a look at your code.

The code is located at https://github.com/mannrobo/starstruck-B
Thanks!

Make doesn’t know it needs to build the subdirectories of src (like src/abstractions). See something like https://github.com/mannrobo/starstruck-B/blob/master/Makefile#L43 to modify src/Makefile. You’ll need to define which subdirectories to recurse into like on 8.

When I do this, it requires that I specify a Makefile inside said subdirectories. Is there a format for these? Thanks!

src/utility/Makefile is almost correct - just need the ROOT variable to point to the ROOT directory (not src)

Look at the Link Instruction Line:


LN ./bin/auto.o ./bin/init.o ./bin/opcontrol.o ./bin/utility.o ./firmware/libpros.a -lgcc -lm to bin/output.elf

Utility, which defines


moveArm

, is placed after the opcontrol, where it’s used. Is this a problem?