Archived

This topic is now archived and is closed to further replies.

VC++ .NET - Frelled-up Friend Functions (Solved)

This topic is 5042 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright. I'm working with an SDK which makes use of friend functions. I'm a newbie C++ programmer -- this is literally my first C++ project after "Hello World" -- but up until now the SDK's been this nice black box, and I've had no trouble getting things done. Then I upgraded from VC++ 5.0 to VC++ .NET 2003. Attempting to compile my imported project, I got a ton of "C3767: [Name] matching function is not accessible." errors. I applied the described fix to the .h file with the problem -- took the friend functions out of the class they were defined in, leaving a declaration, and then defined them outside of the class. So I try to rebuild, and I get a ton of LNK 4006: already defined in object, for what looks like all the functions I moved. Oh, and LNK2005's, too. Obviously I did something wrong with my fix, and I suspect the exact nature of the wrongness may be equally obvious to an experienced C++ programmer... but I'm stumped. I'd appreciate whatever help anyone can offer. [edited by - Logodae on February 23, 2004 12:23:36 PM]

Share this post


Link to post
Share on other sites
Post the code. Just a hunch, but it sounds like your moving the declaration outside the class in the header, which will cause a linker error when you include it multiple times. You should move the declarations to a source file instead of defining them in the header.

Share this post


Link to post
Share on other sites