DJGPP Problem! [Solved]

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

DJGPP Problem! [Solved]

Post by pcmattman »

I've noticed this problem come up several times in the last week. Whenever I make a large change (like today, refactoring the whole device management scheme) the linker complains about either multiple definitions or missing symbols.

The multiple definitions are (with some investigation) caused by the deletion of their counterparts in the source file not being changed in the object, even though it's blatantly obvious that the function does not exist anymore in the source code (and the objects are cleaned every build anyway).

The missing symbols are probably caused by the same. Changes made, references to symbols that aren't built properly, fail.

It seems that the only context this happens is within the library I build to save time when I just need to rebuild the shell.

I'm going to test and make all files be linked as the same file (no lib) and see if it works...

Testing...

No, the problem still remains :(

Edit: it seems almost as though my old version of the file is 'cached' by gcc so that edits don't really get compiled, but the older version does :?.

Edit 2: Here's the output:

Code: Select all

conio_lib.o(.text+0x4e3):conio_lib.c: multiple definition of `_putc'
file_io_main.o(.text+0x17b7):file_io_main.c: first defined here
conio_lib.o(.text+0x501):conio_lib.c: multiple definition of `_puts'
file_io_main.o(.text+0x17ea):file_io_main.c: first defined here
UserMain_main.o(.text+0xa3e):UserMain_main.c: undefined reference to `_stdout'
I used to have putc, puts etc... in conio_lib (remnants from first implementation of printf). Now they're in file_io_main which is where I've put wrappers for devices.

Edit 3: Ok, proof that would hold up in the court of law. Including a return statement into a function returning void usually throws an error (I've checked this). Putting it into one of the functions I'm talking about here causes no error whatsoever. I have no idea why on earth this is happening. I'm going to go delete my temp files and see if that fixes it :(.

Edit 4: It occurred to me that I still had a lot of old copies of the files in a folder in my kernel development directory. A simple */*_lib.c made gcc look there, link them in and destroy the real object file.

At least now I can bask in the radiance of a well-solved problem...
Post Reply