Code::Blocks Forums

User forums => Help => Topic started by: astropirate on April 21, 2009, 11:59:58 pm

Title: Winsock Wont compile
Post by: astropirate 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:
Title: Re: Winsock Wont compile
Post by: astropirate 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... <_<
Title: Re: Winsock Wont compile
Post by: MortenMacFly 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.