could not find -lwsock32.lib

This is a discussion on could not find -lwsock32.lib within the C++ Programming forums, part of the General Programming Boards category; Hi all, I installed mingw and code::blocks on my computer. While trying to learn the basis of network programming, I ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    9

    could not find -lwsock32.lib

    Hi all,

    I installed mingw and code::blocks on my computer. While trying to learn the basis of network programming, I got an error message that “could not find -lwsock32.lib”. so I searched this file on my computer and find that it does not exist. I googled and find a remedy that to download the Microsoft platform SDK. Do I need to install Microsoft platform SDK? Are there any other options to get this library files?

    Thanks and regards,
    Thomas

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There is no reason NOT to download/install the SDK. It will contain other necessary "stuff" if you want to develop for Windows, so you'll be happy to have it. Is there any particular reason you don't want to do so?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    9
    I thought mingw have its own SDK. May be this thought is a foolishness.

    Thanks for your reply.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by thomas_joyee View Post
    I thought mingw have its own SDK. May be this thought is a foolishness.

    Thanks for your reply.
    No, that's the entire point of "Minimal Gnu for Windows (mingw)" - it uses publicly available ("free") Windows components as much as it can.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    217
    Wouldn't it be called libwsock32.a?

    Open the Code::Blocks project file in Code::Blocks. Go to Project->Build Options and select the target (should be Release and Debug). Under "Linker Settings" add "wsock32" without any extension. This should link to libwsock32.a
    Last edited by 39ster; 07-14-2008 at 04:57 AM.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by 39ster View Post
    Wouldn't it be called libwsock32.a?
    No, because it uses the standard Windows version of libraries, and they are called .lib.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    9
    Thanks for your clarification

    I found another solution that use the “dlltool” to export library files. How about it?

  8. #8
    Registered User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    217
    Quote Originally Posted by matsp View Post
    No, because it uses the standard Windows version of libraries, and they are called .lib.

    --
    Mats
    There's a file called libwsock32.a that comes with the Code::Blocks/Mingw package. I didn't even think you could use .lib files in mingw.

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,047
    In modern Windows compilers, .lib and .a files are exactly the same thing. That means that you can just take a .lib file, rename it to lib*.a, and link to it with MinGW's gcc/g++!

    [edit] I'm not completely certain about this, but I read it somewhere and it seemed to work with SDL_image. [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. [NEWBIE] Trying to find the value of 'e'
    By prominababy in forum C Programming
    Replies: 6
    Last Post: 10-08-2008, 12:57 PM
  3. How to find O of threads ?
    By jabka in forum C Programming
    Replies: 3
    Last Post: 03-11-2008, 12:25 PM
  4. how do u find 2nd largest number??
    By juancardenas in forum C Programming
    Replies: 8
    Last Post: 02-14-2003, 07:28 AM
  5. Q: Recursion to find all paths of a maze
    By reti in forum C Programming
    Replies: 7
    Last Post: 11-26-2002, 08:28 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21