mkulke / ftplibpp

Platform independent c++ library providing ftp client functionality.
GNU Lesser General Public License v2.1
289 stars 106 forks source link

msvc11 compile error #2

Open maksqwe opened 10 years ago

maksqwe commented 10 years ago

"error C2079: 'ftphandle::idletime' uses undefined struct 'timeval'"

struct 'timeval' defined in "winsock2.h": http://msdn.microsoft.com/en-us/library/windows/desktop/ms740560%28v=vs.85%29.aspx

fix:

#ifndef _WIN32
#include <unistd.h>
#include <sys/time.h>
#else
#include <winsock2.h>
#endif
mkulke commented 10 years ago

hmm weird. In msvc12 "timeval" is defined in "winsock.h", which is included in "ftplib.cpp". In an msvc11 environment "winsock.h" does not contain a "timeval" definition?

maksqwe commented 10 years ago

When I tried compile using msvc11 I got this error. MSDN says that "winsock2.h" is necessary for 'timeval'. Now i checked "winsock.h"(msvc11) and really it contain "timeval" definition. But anyway ftplib.h require include "winsock.h" because of

struct ftphandle {
    char *cput,*cget;
    int handle;
    int cavail,cleft;
    char *buf;
    int dir;
    ftphandle *ctrl;
    int cmode;
    struct timeval idletime; // <===
}

Sorry for my bad English.