PDA

View Full Version : Bug with the GCC toolset?




Thomas Harte
Mar 2, 2008, 05:34 PM
When I try to build my project in Xcode 3.0, GCC fails at the linking step, complaining that it knows a particular destructor should exist (because it's declared in a common header and I'm deleting some of the relevant objects elsewhere) but that it can't be found. As a result, linking fails.

However, my destructor does exist. The weird thing is that if I leave it in one particular file (FreescapeFCLParser.cpp, not that I imagine it makes any difference) then the linker can't find it. If I move it to another file then the linker can find it.

The linker is perfectly able to find every other method implemented in FreescapeFCLParser.cpp, including the object constructor, which is implemented directly below the destructor. If I copy & paste the destructor so that it is in FreescapeFCLParser.cpp twice then I get the expected build failure at the compile stage. However, if I copy it so it is simultaneously in another file then linking goes fine, whether I comment out the original or not.

I really cannot think of a logical reason why this may be the case and think that I may have discovered some sort of bug somewhere in GCC. However, as I think it is nearly 100% more likely that I've done something wrong, I thought I would come here and ask whether there is anything I might not have thought of.

A tiny video (~529 kb, I'd have uploaded to youtube or something but then you wouldn't have been able to make out the words) of my attempts to build the project is available from this URL (http://members.allegro.cc/ThomasHarte/temp/XcodeScreenSnapz001.mov).



Eraserhead
Mar 2, 2008, 06:49 PM
Try a clean and rebuild.

Thomas Harte
Mar 3, 2008, 03:00 AM
I have it makes no difference.

Sayer
Mar 3, 2008, 07:58 AM
Maybe "~Instruction" is a reserved/internal keyword for gcc. Try renaming the destructor class.

Xcode's syntax coloring also doesn't seem to recognize it, which is a clue as well.

yeroen
Mar 3, 2008, 10:28 AM
Can you post here:

1) The declaration of ~Instruction()
2) the line in CFreescape::CCondition::Clear() where the Instruction destructor is being called, either implictly or explicitly?

That may help with the debugging.