Thread: Stupid Error :: MSVC++ 6.0

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Angry Stupid Error :: MSVC++ 6.0

    This is really making me mad. I am trying to make a VERY SIMPLE socket program. I get a stupid error. I have 2 files, socket.h and socket.cpp:

    /* Socket.h */
    // The Class
    class PLSOCKET
    {
    public:
    PLSOCKET ();
    ~PLSOCKET ();
    int PLConnect (char* ip_addr, int port);

    private:
    int plSocket;
    struct sockaddr_in saddr;
    };

    /* Socket.cpp */

    // =============== //
    // This Is The Main Source //
    // File For Our Socket Class //
    // =============== //

    // The Class Definitions
    PLSOCKET::PLSOCKET ()
    {
    plSocket = socket (AF_INET, SOCK_STREAM, 0);
    }
    PLSOCKET::~PLSOCKET ()
    {
    plSocket = INVALID_SOCKET;
    }
    int PLSOCKET::PLConnect (char* ip_addr, int port)
    {
    saddr.sin_addr.s_addr = INADDR_ANY;
    saddr.sin_family = AF_INET;
    saddr.sin_port =htons (port);
    memset (& (saddr.sin_zero), '\0', 8);

    if (bind (plSocket, (struct sockaddr *) &saddr, sizeof (struct sockaddr)) == -1)
    return -1;
    }

    It gives me the error in socket.cpp:

    fatal error C1010: unexpected end of file while looking for precompiled header directive

    I HATE Microsoft. Can anyone tell me why I get this error?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Sometimes I get this if I have cut and pasted from somewhere (more so though with Devc++ than VC++)

    Try retype it into another file.....

  3. #3
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Put #include "stdafx.h" at the top.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling x64 code in VC++ 6.0?
    By cpjust in forum Windows Programming
    Replies: 7
    Last Post: 07-29-2008, 09:36 AM
  2. Visual C++ 6.0 Pro vs Visual C++ 6.0 Enterprise
    By Joelito in forum Tech Board
    Replies: 5
    Last Post: 01-23-2007, 07:00 PM
  3. question about .net to 6.0 change causing errors
    By jverkoey in forum C++ Programming
    Replies: 17
    Last Post: 03-23-2004, 10:45 AM
  4. Visual Studio 6.0 Help
    By L_I_Programmer in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2003, 10:35 PM
  5. ListView 6.0 OnListItemClick Problem
    By blundstrom in forum Windows Programming
    Replies: 1
    Last Post: 07-21-2002, 11:03 AM