Linking error in Visual Studio 2003

snoopdoug1

Platinum Member
Jan 8, 2002
2,164
0
76
Hello,

I'm trying to build a project which links in many other libraries(all of which are built in the same solution). During the linking stage, I get one error that I'm having trouble figuring out. As I said, this is in Visual Studio 2003(C++).

error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char> > __thiscall myMsg::GetClassNameA(void) const...<bunch of garbled txt>

myMsg is a class in one of my other libraries... Any ideas as to what this may be?

I really appreciate any insight you can provide!
 

nickbits

Diamond Member
Mar 10, 2008
4,122
1
81
GetGlassName is #define macro and I bet that it is casuing the problem. Either rename the function or put #undef GetClassName at the top of your header file.
 

snoopdoug1

Platinum Member
Jan 8, 2002
2,164
0
76
ok, I'll give that a shot. You're talking about the header in my myMsg class?

Btw, I see this is your first post. Thanks a lot for signing up to help!
 

snoopdoug1

Platinum Member
Jan 8, 2002
2,164
0
76
Well, that was it. The #undef worked like a charm. Thanks again for signing up just to help :)
 

nickbits

Diamond Member
Mar 10, 2008
4,122
1
81
You're welcome. Glad it worked.

For your reference most of the Win32 functions that take string parameters are actaully #define macros. They look something like this:

#ifdef UNICODE
#define GetClassName GetClassNameW (unicode version)
#else
#define GetClassName GetClassNameA (ansi version)
#endif

That's why your linker error actually had an "A" at the end of the function name.