News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Winsock Wont compile

Started by astropirate, April 21, 2009, 11:59:58 PM

Previous topic - Next topic

astropirate

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
Quoteerror: `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:

astropirate

Ok solution for those of you who have stumbled upon this while searching for the solution to the same problem


add:
#define _WIN32_WINNT
#define _WIN32_WINNT 0x501

Before your includes.

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

MortenMacFly

Quote from: astropirate on April 22, 2009, 07:05:20 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]