Tuesday, 20 August 2013

c++ error lnk2005 when a global function is included

c++ error lnk2005 when a global function is included

background:C++/dll project/vs2012/error lnk2005
I am doing a dll project, and it had been working well until I added a new
.h, which includes a global function and a struct.
Then the compiling(or link?) failed.
Here is the error message:
1>RobotReality.obj : error LNK2005: "double __cdecl GetNumber(void)"
(?GetNumber@@YANXZ) [[ÒѾ­ÔÚ dllmain.obj Öж¨Òå translate: this has been
defined in dllmain.obj]]
1>stdafx.obj : error LNK2005: "double __cdecl GetNumber(void)"
(?GetNumber@@YANXZ) [[ÒѾ­ÔÚ dllmain.obj Öж¨Òå translate: this has been
defined in dllmain.obj]]
I have added "#pragma once" but the problem still exits.
How to solve the problem?
Thanks!

No comments:

Post a Comment