Author Topic: What could be wrong with this library linking setting?  (Read 2899 times)

Offline 198710

  • Multiple posting newcomer
  • *
  • Posts: 32
What could be wrong with this library linking setting?
« on: May 27, 2010, 09:16:52 am »
I tried to move my socket project from linux to windows,everything OK in linux,but it seems "-lwsock32" option never works on windows :(
How does C::B handle the order of the libraries?


[attachment deleted by admin]

Offline Phenom

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: What could be wrong with this library linking setting?
« Reply #1 on: May 27, 2010, 09:57:34 am »
Maybe you should add the library to the "Link libraries" section.
Just click add and type "wsock32".

Also turn on full command line logging and post the build log here.

Offline 198710

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: What could be wrong with this library linking setting?
« Reply #2 on: May 27, 2010, 10:08:19 am »
Thanks!
I tried the command line way and find out that my library should be placed before wsock32,but I'm still wondering if there should be the chance to set the order of libraries manually inside C::B :?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9613
Re: What could be wrong with this library linking setting?
« Reply #3 on: May 27, 2010, 11:06:18 am »
but I'm still wondering if there should be the chance to set the order of libraries manually inside C::B :?
Of course there is! Just re-order the libraries as needed in the build options of your project, tab "linker settings" -> "link libraries". That's what the up-and-down-buttons just right of this box are for. :-)
Oh - and don't forget to add wsock32 as library!!! Not an additional linker command. This will not work otherwise.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ