winsock2.h problem

This is a discussion on winsock2.h problem within the Networking/Device Communication forums, part of the General Programming Boards category; Hi all. I am using Visual C++ Express 2008 Edition and am trying to write a simple internet application, however, ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    150

    winsock2.h problem

    Hi all. I am using Visual C++ Express 2008 Edition and am trying to write a simple internet application, however, I can't seem to get winsock2.h to include right. The compiler keeps coming up with errors about redefinition for some reason. Is it that winsock.h is included in windows.h? I can't figure this one out!
    HA! I WIN!

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Yep. It sure is. Just include windows.h second.

    There is a common way of doing this too...

    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include <winsock2.h>

    But my gripe about that method is sometimes you need some of the stuff that lean and mean removes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 04:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21