I am working on 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 this problem?
Thanks!
Declare them 'static' and let the compiler do the work.