library problem??

Aug 2, 2010 at 8:11am
Hello,

im trying to compile a c++ application (that uses sockets) with codelite + mingw (os: windows). im also a newbie with C++ i hope you can help me with this.

With:

#include <iostream>
#include <stdio.h>
#include <sys/types.h>

#ifdef __MINGW32__
#include <winsock.h>
#include <winsock2.h>
#else
#include <netdb.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <stdint.h>



return ::write(fd, theData, theLen);
C:/Program Files/CodeLite/h264_C++/os.cpp:32: error: '::write' has not been declared

cout << "Failed to resolve " << theServer.c_str() << ": " << hstrerror (h_errno) << endl;
C:/Program Files/CodeLite/h264_C++/os.cpp:104: error: 'hstrerror' was not declared in this scope


if (setsockopt(this->fd, SOL_SOCKET, SO_REUSEADDR,
&aReuseFlag, sizeof aReuseFlag) < 0) {
this->close();
return false;
}

C:/Program Files/CodeLite/h264_C++/os.cpp:143: error: cannot convert 'const int*' to 'const char*' for argument '4' to 'int setsockopt(SOCKET, int, int, const char*, int)'

[i] struct ip_mreqn aMulticastReq; [\i]
C:/Program Files/CodeLite/h264_C++/os.cpp:171: error: aggregate 'ip_mreqn aMulticastReq' has incomplete type and cannot be defined


[i] unsigned int aLength = ntohs(*(u_int16_t*)&aHeader[2]); [\i]
'u_int16_t' was not declared in this scope

it seems a library is missed but i think i declared all that i need. Any idea??
Last edited on Aug 2, 2010 at 8:13am
Aug 2, 2010 at 9:42am
Hi ,
Can i know which editor and compiler are you using for programming ?
Aug 2, 2010 at 3:26pm
The typedef is called uint16_t (not u_int16_t).
Topic archived. No new replies allowed.