stupid name mangling problem

  • Thread starter Thread starter Bruno van Dooren
  • Start date Start date
B

Bruno van Dooren

Hi all,

i have developed a class that has a member called 'PostMessage'

if i only reference this member from within the class context, there is no
problem, but if i trie to execute it as a method, i get the error

error LNK2019: unresolved external symbol "public: void __thiscall
MessageQ::PostMessageA(struct t_Message *)"
(?PostMessageA@MessageQ@@QAEXPAUt_Message@@@Z) referenced in function
"public: void __thiscall Dispatcher::SendMessageA(struct t_Message *)"
(?SendMessageA@Dispatcher@@QAEXPAUt_Message@@@Z)

The offending code is:
msgQ->PostMessage(Message);

where msgQ is an instance of my own class MessageQ, and the method exists
with the correct prototype.

can anybody please tell me how to solve this problem?

thanks,

Bruno.
 
Bruno van Dooren said:
Hi all,

i have developed a class that has a member called 'PostMessage'

if i only reference this member from within the class context, there is no
problem, but if i trie to execute it as a method, i get the error

error LNK2019: unresolved external symbol "public: void __thiscall
MessageQ::PostMessageA(struct t_Message *)"
(?PostMessageA@MessageQ@@QAEXPAUt_Message@@@Z) referenced in function
"public: void __thiscall Dispatcher::SendMessageA(struct t_Message *)"
(?SendMessageA@Dispatcher@@QAEXPAUt_Message@@@Z)

The offending code is:
msgQ->PostMessage(Message);

where msgQ is an instance of my own class MessageQ, and the method exists
with the correct prototype.

can anybody please tell me how to solve this problem?

thanks,

Bruno.

There is an API function with the same name. What happens if you rename it?

/Fredrik
 
Bruno said:
Hi all,

i have developed a class that has a member called 'PostMessage'

if i only reference this member from within the class context, there
is no problem, but if i trie to execute it as a method, i get the
error

#undef PostMessage - it's a macro defined by windows.h (either PostMessageA
or PostMessageW depending on _UNICODE).

-cd
 
Ok that makes sense.
that also explains why it worked within the class definition: i didn't
include windows.h there.

thanks all.

Bruno.
 
Fredrik Wahlgren said:
There is an API function with the same name. What happens if you rename
it?

/Fredrik

thanks for your reply.
my functions linked fine if i renamed them.
as Carl said in his answer, those functions are defined as macros. as a
result, my function names got replaced by the windows function names.

Bruno.
 
Back
Top