hey im tryin to get this program me and my mates are writing to work, but for some reason i ge these errors upon compilation

im using MSVC++ Express Edition and ive downloaded PlatformSDK because it doesnt come standard with it.

1>------ Build started: Project: av_bot, Configuration: Debug Win32 ------
1>Compiling...
1>bot.cpp
1>Linking...
1>inputEmulation.obj : error LNK2019: unresolved external symbol __imp__SendInput@12 referenced in function "void __cdecl pressKey(int * const,int,int)" (?pressKey@@YAXQAHHH@Z)
1>inputEmulation.obj : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function "void __cdecl MouseMove(int,int)" (?MouseMove@@YAXHH@Z)
1>bot.obj : error LNK2001: unresolved external symbol __imp__GetSystemMetrics@4
1>bot.obj : error LNK2019: unresolved external symbol __imp__GetPixel@12 referenced in function "bool __cdecl compareColour(struct tagPOINT,struct myRGB)" (?compareColour@@YA_NUtagPOINT@@UmyRGB@@@Z)
1>bot.obj : error LNK2019: unresolved external symbol __imp__GetDC@4 referenced in function "bool __cdecl compareColour(struct tagPOINT,struct myRGB)" (?compareColour@@YA_NUtagPOINT@@UmyRGB@@@Z)
1>bot.obj : error LNK2019: unresolved external symbol __imp__SetForegroundWindow@4 referenced in function _main
1>bot.obj : error LNK2019: unresolved external symbol __imp__FindWindowA@8 referenced in function "void __cdecl `dynamic initializer for 'windowHandle''(void)" (??__EwindowHandle@@YAXXZ)
1>C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\Project2\Debug\av_bot.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\Project2\Project2\Debug\BuildLog.htm"
1>av_bot - 8 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

ok i got that working now i get this

1>------ Build started: Project: av_bot, Configuration: Debug Win32 ------
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>bot.cpp
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.h(32) : error C2664: 'FindWindowW' : cannot convert parameter 2 from 'const char [18]' to 'LPCWSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(54) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(55) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(80) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(81) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(129) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(130) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(137) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(138) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(145) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(146) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(154) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(155) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(168) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(169) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(173) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(174) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(299) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(300) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(304) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(305) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(319) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(320) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>inputEmulation.cpp
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.h(32) : error C2664: 'FindWindowW' : cannot convert parameter 2 from 'const char [18]' to 'LPCWSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Generating Code...
1>Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\av_bot\av_bot\Debug\BuildLog.htm"
1>av_bot - 2 error(s), 22 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

looks like you are compiling your program for UNICODE. Turn it off. Prject --> Properties (last menu item in the list), then expand the Configuration Properties and select General. Then on the right side of the screen change Character Set to Not Set

Some of those other warnings say that your program is downgrading a double to a long. You will have to decide which data type you want and either change or typecast it. In some cases typecasging will be ok, but in other cases it isn't. So you will have to make a decision on a case-for-case bases.

this is my new error build log
the warnings im not worrying about for now, just the linking part.

1>------ Build started: Project: av_bot, Configuration: Debug Win32 ------
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>bot.cpp
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(54) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(55) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(80) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(81) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(125) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(126) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(133) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(134) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(141) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(142) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(150) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(151) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(164) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(165) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(169) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(170) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(295) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(296) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(300) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(301) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(315) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>c:\documents and settings\owner\my documents\av_bot (from josh)\bot.cpp(316) : warning C4244: '=' : conversion from 'double' to 'LONG', possible loss of data
1>inputEmulation.cpp
1>Generating Code...
1>Compiling manifest to resources...
1>Linking...
1>bot.obj : error LNK2019: unresolved external symbol __imp__SetForegroundWindow@4 referenced in function _main
1>bot.obj : error LNK2019: unresolved external symbol __imp__GetPixel@12 referenced in function "bool __cdecl compareColour(struct tagPOINT,struct myRGB)" (?compareColour@@YA_NUtagPOINT@@UmyRGB@@@Z)
1>bot.obj : error LNK2019: unresolved external symbol __imp__GetDC@4 referenced in function "bool __cdecl compareColour(struct tagPOINT,struct myRGB)" (?compareColour@@YA_NUtagPOINT@@UmyRGB@@@Z)
1>bot.obj : error LNK2019: unresolved external symbol __imp__FindWindowA@8 referenced in function "void __cdecl `dynamic initializer for 'windowHandle''(void)" (??__EwindowHandle@@YAXXZ)
1>inputEmulation.obj : error LNK2001: unresolved external symbol __imp__FindWindowA@8
1>bot.obj : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function "void __cdecl `dynamic initializer for 'ScreenWidth''(void)" (??__EScreenWidth@@YAXXZ)
1>inputEmulation.obj : error LNK2001: unresolved external symbol __imp__GetSystemMetrics@4
1>inputEmulation.obj : error LNK2019: unresolved external symbol __imp__SendInput@12 referenced in function "void __cdecl pressKey(int * const,int,int)" (?pressKey@@YAXQAHHH@Z)
1>C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\av_bot\Debug\av_bot.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\av_bot\av_bot\Debug\BuildLog.htm"
1>av_bot - 9 error(s), 22 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Look up those functions in MSDN and it will tell you what libraries you have to link to. Then add them to the project link settings. Just enter the function name in the search box from here.

to add em to the project link settings thats in project --> properties--> include --> additional library dependancies ?

since u seems to be using vc++, you might try using #pragma comment(lib, "user32.lib"), and try with other libs that way

thanky ou very much for your help guys its now compiling.

just gotta put in the static casts and then just gotta tweak numbers. cheers.

This article has been dead for over six months. Start a new discussion instead.