Funny Error
-
wincap.obj : error LNK2005: "struct HWND__ * ghWndMain" (?ghWndMain@@3PAUHWND__@@A) already defined in dllinit.obj dlgopen.obj : error LNK2001: unresolved external symbol "void * ghInst" (?ghInst@@3PAXA) Debug/asfasasfas.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Can anyone tell me what is the error above?
-
wincap.obj : error LNK2005: "struct HWND__ * ghWndMain" (?ghWndMain@@3PAUHWND__@@A) already defined in dllinit.obj dlgopen.obj : error LNK2001: unresolved external symbol "void * ghInst" (?ghInst@@3PAXA) Debug/asfasasfas.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Can anyone tell me what is the error above?
The first error indicates that you have two objects that contain the same function definition. The second is an error that is caused by not correclty linking to the .lib file for the dll that contains this function. Hope this helps!!
-
wincap.obj : error LNK2005: "struct HWND__ * ghWndMain" (?ghWndMain@@3PAUHWND__@@A) already defined in dllinit.obj dlgopen.obj : error LNK2001: unresolved external symbol "void * ghInst" (?ghInst@@3PAXA) Debug/asfasasfas.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Can anyone tell me what is the error above?
Oh ouch... yuck... Well, you'll have to do a bit of searching here. The LNK2005 indicates that you have more than one definition of ghWndMain. See the docs on LNK2005 for ideas. ghWndMain is declared in HOOK.C and should be extern to other modules. BTW sometimes you can use the FORCE switch to override this, but not a great idea. But hey - maybe all of this stems from the fact that you are trying to use the C++ compiler to compile the WINCAP C sample - or at least integrate into your code(?). If you are not using MFC and stuff, you might be better off using C - if there are only C files in your project, you'll see much different results. hmmm... might need an
extern HINSTANCE ghInst;
in dlgopen.c... BTW with C++, you might also need to useextern "C" HANDLE var;
in certain places instead of justextern HANDLE var;
- this will turn off the name mangling and might help. Maybe someone else has experience with this sample and using / porting it to C++. -
The first error indicates that you have two objects that contain the same function definition. The second is an error that is caused by not correclty linking to the .lib file for the dll that contains this function. Hope this helps!!
For the First error try doing a complete "rebuild" this will delete the .obj files from your build directory and rebuild them. Sometimes this works.
-
Oh ouch... yuck... Well, you'll have to do a bit of searching here. The LNK2005 indicates that you have more than one definition of ghWndMain. See the docs on LNK2005 for ideas. ghWndMain is declared in HOOK.C and should be extern to other modules. BTW sometimes you can use the FORCE switch to override this, but not a great idea. But hey - maybe all of this stems from the fact that you are trying to use the C++ compiler to compile the WINCAP C sample - or at least integrate into your code(?). If you are not using MFC and stuff, you might be better off using C - if there are only C files in your project, you'll see much different results. hmmm... might need an
extern HINSTANCE ghInst;
in dlgopen.c... BTW with C++, you might also need to useextern "C" HANDLE var;
in certain places instead of justextern HANDLE var;
- this will turn off the name mangling and might help. Maybe someone else has experience with this sample and using / porting it to C++. -
Oh ouch... yuck... Well, you'll have to do a bit of searching here. The LNK2005 indicates that you have more than one definition of ghWndMain. See the docs on LNK2005 for ideas. ghWndMain is declared in HOOK.C and should be extern to other modules. BTW sometimes you can use the FORCE switch to override this, but not a great idea. But hey - maybe all of this stems from the fact that you are trying to use the C++ compiler to compile the WINCAP C sample - or at least integrate into your code(?). If you are not using MFC and stuff, you might be better off using C - if there are only C files in your project, you'll see much different results. hmmm... might need an
extern HINSTANCE ghInst;
in dlgopen.c... BTW with C++, you might also need to useextern "C" HANDLE var;
in certain places instead of justextern HANDLE var;
- this will turn off the name mangling and might help. Maybe someone else has experience with this sample and using / porting it to C++. -
Oh ouch... yuck... Well, you'll have to do a bit of searching here. The LNK2005 indicates that you have more than one definition of ghWndMain. See the docs on LNK2005 for ideas. ghWndMain is declared in HOOK.C and should be extern to other modules. BTW sometimes you can use the FORCE switch to override this, but not a great idea. But hey - maybe all of this stems from the fact that you are trying to use the C++ compiler to compile the WINCAP C sample - or at least integrate into your code(?). If you are not using MFC and stuff, you might be better off using C - if there are only C files in your project, you'll see much different results. hmmm... might need an
extern HINSTANCE ghInst;
in dlgopen.c... BTW with C++, you might also need to useextern "C" HANDLE var;
in certain places instead of justextern HANDLE var;
- this will turn off the name mangling and might help. Maybe someone else has experience with this sample and using / porting it to C++. -
#pragma data_seg("._WINCAP") HWND ghWndMain = 0; // Handle to main window -- used to post msgs #pragma data_seg()
Sure - but looks like 16 bit code with that pragma... not to worry, though, should compile... But the wincap sample is pretty dated - old 16 bit code. There should also be a DIBAPI project or makefile - can you compile that? You'll need it. I think what you're trying to do is use the WINCAP sample source directly in a cpp based project, and thats gonna be a bit of a hack. Even though you're getting close. :) I don't have WINCAP.EXE, so don't know exactly what you're up against, and it makes it tough to help. -
I need to enquire whether C complier can complier win32 api source code? If it does , will the resulting .exe ba able to be used in win98 as win98 is win32 ?
I encountered any 'funny' error on viewing the earlier error , i made one change to the code. The change is shown below : #pragma data_seg("._WINCAP") // HWND ghWndMain = 0 ; // Handle to main window -- used to post msgs #pragma data_seg() // IThe change is that i made the statement " HWND ghWndMain = 0 " a comment , therafter i was able to generate an exe . However when i click the exe i see this a windows which only show the background and no menu buttons can be seen.
-
I need to enquire whether C complier can complier win32 api source code? If it does , will the resulting .exe ba able to be used in win98 as win98 is win32 ?
I encountered any 'funny' error on viewing the earlier error , i made one change to the code. The change is shown below : #pragma data_seg("._WINCAP") // HWND ghWndMain = 0 ; // Handle to main window -- used to post msgs #pragma data_seg() // IThe change is that i made the statement " HWND ghWndMain = 0 " a comment , therafter i was able to generate an exe . However when i click the exe i see this a windows which only show the background and no menu buttons can be seen.
-
#pragma data_seg("._WINCAP") HWND ghWndMain = 0; // Handle to main window -- used to post msgs #pragma data_seg()
Sure - but looks like 16 bit code with that pragma... not to worry, though, should compile... But the wincap sample is pretty dated - old 16 bit code. There should also be a DIBAPI project or makefile - can you compile that? You'll need it. I think what you're trying to do is use the WINCAP sample source directly in a cpp based project, and thats gonna be a bit of a hack. Even though you're getting close. :) I don't have WINCAP.EXE, so don't know exactly what you're up against, and it makes it tough to help.