Author Topic: Winsock Wont compile  (Read 10581 times)

astropirate

  • Guest
Winsock Wont compile
« on: April 21, 2009, 11:59:58 pm »
Greetings all!
I have been having this issue for a while. I cannot compile anything with winsock.
i attempted to compile http://msdn.microsoft.com/en-us/library/ms737593(VS.85).aspx i included all the requred libraries but it would still not compile. it says
Quote
error: `getaddrinfo' was not declared in this scope
error: `freeaddrinfo' was not declared in this scope

which are in "ws2tcpip.h"

Any help please?


P.S
the code compiles fine when i use Dev-C++ but i personal prefer C::B   :lol:
« Last Edit: April 22, 2009, 12:03:00 am by astropirate »

astropirate

  • Guest
Re: Winsock Wont compile
« Reply #1 on: April 22, 2009, 07:05:20 am »
Ok solution for those of you who have stumbled upon this while searching for the solution to the same problem


add:
Code
#define _WIN32_WINNT
#define _WIN32_WINNT 0x501
Before your includes.

You would think Code::Blocks would do it for you... <_<

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Winsock Wont compile
« Reply #2 on: April 22, 2009, 07:14:58 am »
You would think Code::Blocks would do it for you... <_<
Why should it? What if I want to pass a different version?
It's up to the developer to pass needed DEFINES as arguments to the compiler. Check your project options -> Compiler -> Defines.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ