LNK2005 Error in CLR Windows Form
<p>I'm working on developing a Windows CLR form to create GUI interaction for some code I've been handling as a console program.</p>
<p>When I include the header in the console portion of the code, both of my headers play fine together, but when I try to include them in the <em>form</em>, they result in the following:</p>
<blockquote>
<p>librarytest.obj: error LNK2005: _SeqWait already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _KillDLL already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _SetSinFreq2 already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _ConnectDirect already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _GetDevice already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _SetSinFreq_Fine2 already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _Connect already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _TacOnTimeForTAction already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _SetSinFreq1 already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _GetLastEAIError already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _SetGain already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _Disconnect already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _ReadFWVer already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _SetSinFreq_Fine1 already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _SetSigSrc already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _ClosePort already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _ShowDebugInfo already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _OpenPort already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _DiscoverDevices already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _TacOnTime already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _PulseOnTime already defined in Gesture_Elicitor.obj</p>
<p>librarytest.obj : error LNK2005: _tactorhandle already defined in Gesture_Elicitor.obj</p>
<p>....</p>
</blockquote>
<p>The interesting problem is that one of my headers (&quot;wiimote.h&quot;, from the WiiYourself project) works fine if its the only one included. The problem lies with &quot;tactor_cHeader.h&quot;, which connects to its .dll . The abbreviated code in question is as follows:</p>
<pre><code>#ifndef TACTOR_H_
#define TACTOR_H_

using namespace std;

#include &lt;windows.h&gt;

...

typedef int (*ConnectDirectPtr)(char*name, int type);
typedef int (*TacOnTimePtr)(int cidx, int board, int tacNum, int durMilli, bool returnifprocessing);
typedef int (*SetFreqPtr)(int cidx, int board, int freq, bool returnifprocessing);
typedef int (*KillDLLptr)();
typedef int (*SeqWaitPtr)(int cidx, int board, int waitTime, bool returnifprocessing);
...

ConnectDirectPtr ConnectDirect;
TacOnTimePtr TacOnTimeForTaction;
SetFreqPtr SetSinFreq1;
SetFreqPtr SetSinFreq2;
KillDLLptr KillDLL;
SeqWaitPtr SeqWait;
...

HINSTANCE tactorhandle = NULL;

inline int InitTactorDLL()
{
    tactorhandle = LoadLibrary(&quot;Tactor_DLL.dll&quot;);
    if (tactorhandle == 0)
        return -1;
    SeqWait = (SeqWaitPtr)GetProcAddress(tactorhandle, &quot;SeqWait&quot;);
    ConnectDirect = (ConnectDirectPtr)GetProcAddress(tactorhandle, &quot;ConnectDirect&quot;);
    TacOnTime = (TacOnTimePtr)GetProcAddress(tactorhandle, &quot;TacOnTime&quot;);
    SetSinFreq1 = (SetFreqPtr)GetProcAddress(tactorhandle, &quot;SetSinFreq1&quot;);
    SetSinFreq2 = (SetFreqPtr)GetProcAddress(tactorhandle, &quot;SetSinFreq2&quot;);
    KillDLL = (KillDLLptr)GetProcAddress(tactorhandle, &quot;KillDLL&quot;);
}

#endif
</code></pre>
<p>So what is it about this header that isn't playing nice with my form?</p>