linker errors in MSVC++ 2005

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2005
Posts: 62
Reputation: Slavrix is an unknown quantity at this point 
Solved Threads: 0
Slavrix Slavrix is offline Offline
Junior Poster in Training

linker errors in MSVC++ 2005

 
0
  #1
Nov 12th, 2007
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. 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 ==========
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: linker errors in MSVC++ 2005

 
0
  #2
Nov 12th, 2007
Go through step 3 of this link.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 62
Reputation: Slavrix is an unknown quantity at this point 
Solved Threads: 0
Slavrix Slavrix is offline Offline
Junior Poster in Training

Re: linker errors in MSVC++ 2005

 
0
  #3
Nov 12th, 2007
ok i got that working now i get this
  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 ==========
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,620
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1493
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: linker errors in MSVC++ 2005

 
0
  #4
Nov 12th, 2007
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 62
Reputation: Slavrix is an unknown quantity at this point 
Solved Threads: 0
Slavrix Slavrix is offline Offline
Junior Poster in Training

Re: linker errors in MSVC++ 2005

 
0
  #5
Nov 12th, 2007
this is my new error build log
the warnings im not worrying about for now, just the linking part.

  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 ==========
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,620
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1493
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: linker errors in MSVC++ 2005

 
0
  #6
Nov 12th, 2007
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 62
Reputation: Slavrix is an unknown quantity at this point 
Solved Threads: 0
Slavrix Slavrix is offline Offline
Junior Poster in Training

Re: linker errors in MSVC++ 2005

 
0
  #7
Nov 12th, 2007
to add em to the project link settings thats in project --> properties--> include --> additional library dependancies ?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 5
Reputation: Garock is an unknown quantity at this point 
Solved Threads: 0
Garock Garock is offline Offline
Newbie Poster

Re: linker errors in MSVC++ 2005

 
0
  #8
Nov 13th, 2007
since u seems to be using vc++, you might try using #pragma comment(lib, "user32.lib"), and try with other libs that way
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 62
Reputation: Slavrix is an unknown quantity at this point 
Solved Threads: 0
Slavrix Slavrix is offline Offline
Junior Poster in Training

Re: linker errors in MSVC++ 2005

 
0
  #9
Nov 14th, 2007
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC