« Converting TDateTimes to System.DateTimes and back | The Burger Of Eternal Fullness » |
There are few things more fun than topping off a righteously sweaty code refactoring session with a particularly rare and un-to-underdocumented linker error.
I ran into this in CodeGear RAD Studio 2007 on the Delphi for .NET side. It was different than the small handful of problems I saw other people run into, and since I managed to track it down to a particular line, I thought I would share it.
My encounter with this linker error happened when using a named constant set, e.g.
const
FIELD_BLOB_TYPES : set of MyFieldType = [mftBinary, mftGraphic, mftDiagram, mftAttachments]
The code that caused the explosion simply used the type:
if Attribute.ValueType in FIELD_BLOB_TYPES then
...
Replacing it with the full set fixed the issue:
if Attribute.ValueType in [mftBinary, mftGraphic, mftDiagram, mftAttachments] then
...
Note that using this code construct is no guarantee that this linker issue will happen - I actually use this construct in other parts of my code with no problem - but if you do run into this weird linker error, this may be the straw that is breaking the camel's back.
Hopefully, I can save someone out there from the frustration.
One other way it can happen is when something is holding onto the existing .pdb file.
Today, it occurred because I was running AQTime elsewhere, but the project still was set to look up debug information in my output folder. I thought it would just read the files; I did not think it would hold onto them.
So, try to delete your .pdb files if you get this error, especially if it suddenly starts happening when it never has before.