944,135 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2345
  • C++ RSS
Nov 12th, 2007
0

linker errors in MSVC++ 2005

Expand Post »
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.



C++ Syntax (Toggle Plain Text)
  1. 1>------ Build started: Project: av_bot, Configuration: Debug Win32 ------
  2. 1>Compiling...
  3. 1>bot.cpp
  4. 1>Linking...
  5. 1>inputEmulation.obj : error LNK2019: unresolved external symbol __imp__SendInput@12 referenced in function "void __cdecl pressKey(int * const,int,int)" (?pressKey@@YAXQAHHH@Z)
  6. 1>inputEmulation.obj : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function "void __cdecl MouseMove(int,int)" (?MouseMove@@YAXHH@Z)
  7. 1>bot.obj : error LNK2001: unresolved external symbol __imp__GetSystemMetrics@4
  8. 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)
  9. 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)
  10. 1>bot.obj : error LNK2019: unresolved external symbol __imp__SetForegroundWindow@4 referenced in function _main
  11. 1>bot.obj : error LNK2019: unresolved external symbol __imp__FindWindowA@8 referenced in function "void __cdecl `dynamic initializer for 'windowHandle''(void)" (??__EwindowHandle@@YAXXZ)
  12. 1>C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\Project2\Debug\av_bot.exe : fatal error LNK1120: 6 unresolved externals
  13. 1>Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\Project2\Project2\Debug\BuildLog.htm"
  14. 1>av_bot - 8 error(s), 0 warning(s)
  15. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Slavrix is offline Offline
67 posts
since Oct 2005
Nov 12th, 2007
0

Re: linker errors in MSVC++ 2005

Go through step 3 of this link.
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Nov 12th, 2007
0

Re: linker errors in MSVC++ 2005

ok i got that working now i get this
C++ Syntax (Toggle Plain Text)
  1. 1>------ Build started: Project: av_bot, Configuration: Debug Win32 ------
  2. 1>Compiling...
  3. 1>stdafx.cpp
  4. 1>Compiling...
  5. 1>bot.cpp
  6. 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'
  7. 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. 1>inputEmulation.cpp
  31. 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'
  32. 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
  33. 1>Generating Code...
  34. 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"
  35. 1>av_bot - 2 error(s), 22 warning(s)
  36. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Slavrix is offline Offline
67 posts
since Oct 2005
Nov 12th, 2007
0

Re: linker errors in MSVC++ 2005

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.
Last edited by Ancient Dragon; Nov 12th, 2007 at 12:15 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,963 posts
since Aug 2005
Nov 12th, 2007
0

Re: linker errors in MSVC++ 2005

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

C++ Syntax (Toggle Plain Text)
  1. 1>------ Build started: Project: av_bot, Configuration: Debug Win32 ------
  2. 1>Compiling...
  3. 1>stdafx.cpp
  4. 1>Compiling...
  5. 1>bot.cpp
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 1>inputEmulation.cpp
  29. 1>Generating Code...
  30. 1>Compiling manifest to resources...
  31. 1>Linking...
  32. 1>bot.obj : error LNK2019: unresolved external symbol __imp__SetForegroundWindow@4 referenced in function _main
  33. 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)
  34. 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)
  35. 1>bot.obj : error LNK2019: unresolved external symbol __imp__FindWindowA@8 referenced in function "void __cdecl `dynamic initializer for 'windowHandle''(void)" (??__EwindowHandle@@YAXXZ)
  36. 1>inputEmulation.obj : error LNK2001: unresolved external symbol __imp__FindWindowA@8
  37. 1>bot.obj : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function "void __cdecl `dynamic initializer for 'ScreenWidth''(void)" (??__EScreenWidth@@YAXXZ)
  38. 1>inputEmulation.obj : error LNK2001: unresolved external symbol __imp__GetSystemMetrics@4
  39. 1>inputEmulation.obj : error LNK2019: unresolved external symbol __imp__SendInput@12 referenced in function "void __cdecl pressKey(int * const,int,int)" (?pressKey@@YAXQAHHH@Z)
  40. 1>C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\av_bot\Debug\av_bot.exe : fatal error LNK1120: 6 unresolved externals
  41. 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"
  42. 1>av_bot - 9 error(s), 22 warning(s)
  43. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Slavrix is offline Offline
67 posts
since Oct 2005
Nov 12th, 2007
0

Re: linker errors in MSVC++ 2005

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.
Last edited by Ancient Dragon; Nov 12th, 2007 at 8:52 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,963 posts
since Aug 2005
Nov 12th, 2007
0

Re: linker errors in MSVC++ 2005

to add em to the project link settings thats in project --> properties--> include --> additional library dependancies ?
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Slavrix is offline Offline
67 posts
since Oct 2005
Nov 13th, 2007
0

Re: linker errors in MSVC++ 2005

since u seems to be using vc++, you might try using #pragma comment(lib, "user32.lib"), and try with other libs that way
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Garock is offline Offline
5 posts
since Nov 2007
Nov 14th, 2007
0

Re: linker errors in MSVC++ 2005

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.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Slavrix is offline Offline
67 posts
since Oct 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Stack help: Run-Time Check Failure #2
Next Thread in C++ Forum Timeline: trying to display a join file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC