I am working on creating a Windows CLR form to create GUI interactions for some code that I processed as a console program.
When I include a header in the console part of the code, both of my headers work fine together, but when I try to include them in the form, they lead to the following:
librarytest.obj: LNK2005 error: _SeqWait is already defined in Gesture_Elicitor.obj
librarytest.obj: error LNK2005: _KillDLL already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _SetSinFreq2 already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _ConnectDirect already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _GetDevice already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _SetSinFreq_Fine2 already defined in Gesture_Elicitor.obj
librarytest.obj: error LNK2005: _Connection is already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _TacOnTimeForTAction already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _SetSinFreq1 is already defined in Gesture_Elicitor.obj
librarytest.obj: error LNK2005: _GetLastEAIError is already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _SetGain is already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _Disconnect is already defined in Gesture_Elicitor.obj
librarytest.obj: error LNK2005: _ReadFWVer is already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _SetSinFreq_Fine1 already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _SetSigSrc already defined in Gesture_Elicitor.obj
librarytest.obj: error LNK2005: _ClosePort is already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _ShowDebugInfo is already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _OpenPort is already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _DiscoverDevices already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _TacOnTime already defined in Gesture_Elicitor.obj
librarytest.obj: LNK2005 error: _PulseOnTime already defined in Gesture_Elicitor.obj
librarytest.obj: error LNK2005: _tactorhandle is already defined in Gesture_Elicitor.obj
....
An interesting problem is that one of my headers ("wiimote.h", from the WiiYourself project) works fine if only one is included in it. The problem is "tactor_cHeader.h", which connects to its .dll. The abbreviated code in question is as follows:
#ifndef TACTOR_H_ #define TACTOR_H_ using namespace std; #include <windows.h> ... 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("Tactor_DLL.dll"); if (tactorhandle == 0) return -1; SeqWait = (SeqWaitPtr)GetProcAddress(tactorhandle, "SeqWait"); ConnectDirect = (ConnectDirectPtr)GetProcAddress(tactorhandle, "ConnectDirect"); TacOnTime = (TacOnTimePtr)GetProcAddress(tactorhandle, "TacOnTime"); SetSinFreq1 = (SetFreqPtr)GetProcAddress(tactorhandle, "SetSinFreq1"); SetSinFreq2 = (SetFreqPtr)GetProcAddress(tactorhandle, "SetSinFreq2"); KillDLL = (KillDLLptr)GetProcAddress(tactorhandle, "KillDLL"); } #endif
So what is this heading that doesn't play well with my form?