Recommended Posts

ok so im currently working on a game and i've been getting some strange outputs i wont copy in all my source code because there is alot and everything is set correctly.... well that i know of.
error C2664: 'TextOutW' : cannot convert parameter 4 from 'const char *' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C2664: 'CreateWindowExW' : cannot convert parameter 3 from 'const char *' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

obviously my clock object is having trouble with the linker?... and its something to do with timeGetTime() but what i dont get is my clock.cpp/.h are part of my re-useable code so i just copy and paste it and it's worked in other app's i've used it in.. so i dont get the problem

obviously my clock object is having trouble with the linker?... and its something to do with timeGetTime() but what i dont get is my clock.cpp/.h are part of my re-useable code so i just copy and paste it and it's worked in other app's i've used it in.. so i dont get the problem

What's happening is that your source file, CClock.cpp (I'm assuming), is troubling the linker; the file is saying "Here's all the definitions for the CClock methods as declared in CClock.h; oh, and I'm also using timeGetTime() as I see it declared -- but not defined -- in <windows.h>, I'll rely on the linker to supply the definition to me later." Then the linker is saying, "Awesome, CClock.obj, has a the definitions for CClock! It also looks like it's needing a definition of timeGetTime(), but I don't have a definition for it!"

You'll need to link winmm.lib to your project for the timeGetTime function. Go to your project settings, select "input" under "linker", and append winmm.lib in the "Additional libraries" field.

Also, for future reference, you can usually Google the terms "msdn [function name]" and the documents usually state which microsoft libraries to link with which functions.