Tool
Tool

Reputation: 12488

How to compile a c++ project that requires <winsock2.h>?

I downloaded a project that has these 2 lines in it:

#include <winsock2.h>
#include <Afxwin.h>

I'm confused about on how to compile this, because my standard compiler can't find the selected files.

What do I need to to configure my compiler's search path in order to successfully compile this?

The compiler I tried it with is Dev-C++.

Edit: I'm guessing I have to configure certain libraries to be used when compiling (but which?)

Upvotes: 1

Views: 3384

Answers (2)

Timo Geusch
Timo Geusch

Reputation: 24351

winsock2.h is part of the Windows SDK and Afxwin.h is the main MFC/ATL include file.

You should be able to download the current Windows SDK from the Microsoft site, but that will not include the MFC code - I'm pretty sure you'll need to have Visual Studio in order to be able to use MFC and ATL.

Upvotes: 0

Mark Stevens
Mark Stevens

Reputation: 2366

Are you building on Windows?

These are Microsoft includes files. If you have Visual Studio, winsock should be available. But for afx (MFC), you need a commercial edition I believe.

If you have a commercial Visual Studio and it still can't find them, it's just a matter of configuring the compiler to include the proper directories (but it should have come that way out of the box).

Upvotes: 1

Related Questions