Skip to main content

Posts

Showing posts with the label lnk2005

Solving pesky LNK2005 errors...

For those who read this blog and aren't technically inclined or simply don't use Microsoft Visual Studio (e.g. you use a different compiler suite), this entry isn't for you. One of most annoying things to run into in Visual C++ are linker errors. They are obtuse, poorly documented, and double-clicking them doesn't take you to the source code (or the part of the object file) where the problem is occurring. One of the most confounding error messages is the LNK2005 error message. Usually something like this shows up: nafxcwd.lib(afxmem.obj) : error LNK2005 ...something about operator new/delete goes here... If you search Google, a Microsoft Knowledgebase (KB) article pops up (KB148652): http://support.microsoft.com/kb/148652 A lot of people run into LNK2005 errors, find the above article, try out what it says, and discover the "solution" makes the problem worse, not better. That is the only KB article I've ever seen that provides an incorrect solution for a p...