Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Thomas Harte

macrumors 6502
Original poster
Nov 30, 2005
400
4
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.
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
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

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.