Advertisement

Semi-OT: Help with this lame program I made...

Started by December 22, 2001 09:27 PM
0 comments, last by Sketchy 23 years, 2 months ago
Hi, I''m getting these stupid "unresolved external symbol" error in my program and I dont know why. Here is how my proggy works: I have a main file that creates an OpenGL window and draws a triangle on the screen. I wanted to try out some DirectInput to change the triangle color depending on the mouse location. So I have a simple DirectInput library, and it has 2 extern variables, the windows HINSTANCE and HWND (which it must use to link the mouse stuff with the window or something). I included the libraries .h file in the main file, which has HISTANCE and HWND variables in it (at the top of the code, with same name as those extern variables of the library). But for some reason, this doesn''t work, and I get the errors: CInputLib.obj : error LNK2001: unresolved external symbol "struct HINSTANCE__ * main_instance" (?main_instance@@3PAUHINSTANCE__@@A) CInputLib.obj : error LNK2001: unresolved external symbol "struct HWND__ * main_window_handle" (?main_window_handle@@3PAUHWND__@@A) win32.obj : error LNK2001: unresolved external symbol _DInput_Read_Mouse win32.obj : error LNK2001: unresolved external symbol _DInput_Shutdown win32.obj : error LNK2001: unresolved external symbol _DInput_Release_Mouse win32.obj : error LNK2001: unresolved external symbol _DInput_Init_Mouse win32.obj : error LNK2001: unresolved external symbol _DInput_Init Debug/test.exe : fatal error LNK1120: 7 unresolved externals Error executing link.exe.
I assume you are using MSVC. Rather than simply telling you what the errors mean, here''s something that you will find more useful in the long run. If you place your cursor in the Output window (where the errors appear) on the error code (LNK2001 in this case) and hit F1, you will be taken to the appropriate reference page in your local copy of the MSDN Library. On the page for LNK2001, for example, you''ll find a list of possible causes.

The same behavior exists for all compile and link errors.

(Unresolved external generally means you''re missing either a source file or a library file that contains a function''s definition, or a variable''s declaration).

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

This topic is closed to new replies.

Advertisement