addrinfo Structure Not Working

This is a discussion on addrinfo Structure Not Working within the Networking/Device Communication forums, part of the General Programming Boards category; I'm trying to learn networking in C++, but whenever I compile this I get a bunch of 'undeclared identifiers' etc. ...

addrinfo Structure Not Working

I'm trying to learn networking in C++, but whenever I compile this I get a bunch of 'undeclared identifiers' etc. If I compile it with <winsock2.h> I get about 86 errors, and when I click on them it takes me to the actual winsock2.h header file. I've included winsock32.lib and wsock32.lib in my linker options too.. Here's what I have so far:

The Winsock2.h header file internally includes core elements from the Windows.h header file, so there is not usually an #include line for the Windows.h header file in Winsock applications. If an #include line is needed for the Windows.h header file, this should be preceded with the #define WIN32_LEAN_AND_MEAN macro. For historical reasons, the Windows.h header defaults to including the Winsock.h header file for Windows Sockets 1.1. The declarations in the Winsock.h header file will conflict with the declarations in the Winsock2.h header file required by Windows Sockets 2.0. The WIN32_LEAN_AND_MEAN macro prevents the Winsock.h from being included by the Windows.h header.

Alright that didn't work, I removed the Windows.h, and tried just using iostream and winsock.h, which produced the same undeclared identifiers errors, so I tried winsock2.h with iostream, which also produced the exact same errors. any ideas?