Linker Errors
I''m getting a link error, but I haven''t a clue why. I know it has something to do with my DirectInput initialization, but I''m linking DINPUT8.LIB and I don''t know what else to look at here.
The errors are:
Main.obj : error LNK2019: unresolved external symbol "long __cdecl InitDI(struct HINSTANCE__ *)" (?InitDI@@YAJPAUHINSTANCE__@@@Z) referenced in function _WinMain@16
Debug/Game.exe : fatal error LNK1120: 1 unresolved externals
How do you know what this is when it seems like such a cryptic message? Anyone have a link that tells you how to troubleshoot linker errors?
Main.obj : Object file the error occured in.
error LNK2019: unresolved external symbol Something was declared but not defined.
"long Function return type (duh)
__cdecl Calling convention (as opposed to __stdcall)
InitDI(struct HINSTANCE__ *)" Function name and parameters (in this case, an HINSTANCE - research how Win32 HANDLEs work)
(?InitDI@@YAJPAUHINSTANCE__@@@Z) Decorated function name (see below)
referenced in function _WinMain@16 Place the function was called from.
About function mangling:
*Prefixed by ?
*Function name
*@ indicates it''s not an operator (& end of class name)
*@ something to do with class name qualification...
*YAJPAU means Function Type Code (Y), normal storage(A), parameter long pointer(JP), __cdecl convention(A), (I dunno what ''U'' is)
*@ is end of argument list
*Z is the signature terminator.
So there''s your basic lesson in function name mangling, or "decoration."
As for your problem, this sometimes occurs when a CPP file is not included in the workspace.
P.S. Almost forgot. _WinMain@16. The underscore means it''s a function defined by the compiler manufacturer, WinMain is the function name, @ is a delimiter (end of function name), and 16 is the total size of the params passed to it in bytes(handle (long - 4)+handle (long - 4)+char*(32-bit pointer - 4)+int(4).
Peace,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
error LNK2019: unresolved external symbol Something was declared but not defined.
"long Function return type (duh)
__cdecl Calling convention (as opposed to __stdcall)
InitDI(struct HINSTANCE__ *)" Function name and parameters (in this case, an HINSTANCE - research how Win32 HANDLEs work)
(?InitDI@@YAJPAUHINSTANCE__@@@Z) Decorated function name (see below)
referenced in function _WinMain@16 Place the function was called from.
About function mangling:
*Prefixed by ?
*Function name
*@ indicates it''s not an operator (& end of class name)
*@ something to do with class name qualification...
*YAJPAU means Function Type Code (Y), normal storage(A), parameter long pointer(JP), __cdecl convention(A), (I dunno what ''U'' is)
*@ is end of argument list
*Z is the signature terminator.
So there''s your basic lesson in function name mangling, or "decoration."
As for your problem, this sometimes occurs when a CPP file is not included in the workspace.
P.S. Almost forgot. _WinMain@16. The underscore means it''s a function defined by the compiler manufacturer, WinMain is the function name, @ is a delimiter (end of function name), and 16 is the total size of the params passed to it in bytes(handle (long - 4)+handle (long - 4)+char*(32-bit pointer - 4)+int(4).
Peace,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[twitter]warrenm[/twitter]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement