errors with classes (again)

This is a discussion on errors with classes (again) within the C++ Programming forums, part of the General Programming Boards category; I'm trying to write some more classes and I'm getting errors with the deconstructor/constructor. I have no idea how to ...

  1. #1
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640

    errors with classes (again)

    I'm trying to write some more classes and I'm getting errors with the deconstructor/constructor. I have no idea how to interpret the error:
    sockets.h(43) : error C2600: 'WINSOCKET::WINSOCKET' : cannot define a compiler-generated special member function (must be declared in the class first)
    sockets.h(52) : error C2600: 'WINSOCKET::~WINSOCKET' : cannot define a compiler-generated special member function (must be declared in the class first)
    what to do?

    PHP Code:
    WINSOCKET::WINSOCKET(){
        
    wVersionRequested MAKEWORD(1,1);
        
    nRet WSAStartup(wVersionRequested, &wsaData);
    /*    if (wsaData.wVersion != wVersionRequested)    
            return WRONG_VERSION;
        else
            return SUCCESS;*/
    }

    WINSOCKET::~WINSOCKET(){
        
    closesocket(theSocket);

    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    162
    Did you declare the constructor and destructor in the public section of your class? You do it like this:
    PHP Code:
    class WINSOCKET
    {
      public:
      
    WINSOCKET();
       ~
    WINSOCKET();
       
    ///plus everything else
    }; 

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Classes with Other Classes as Member Data
    By njd in forum C++ Programming
    Replies: 2
    Last Post: 09-27-2005, 09:30 AM
  2. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM
  3. Help me with these errors... :-(
    By major_small in forum C++ Programming
    Replies: 6
    Last Post: 09-07-2003, 08:18 PM
  4. High Schoolers - Techy Classes?
    By mart_man00 in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 05-09-2003, 02:14 PM
  5. Classes Compiler Errors
    By taiDasher in forum C++ Programming
    Replies: 5
    Last Post: 07-03-2002, 08:11 AM

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