mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-06 11:38:34 +03:00
Include winsock2.h on Windows.
This makes socket code build successfully on Windows.
This commit is contained in:
parent
abfdb61bc9
commit
4647986a12
@ -3,13 +3,13 @@
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include "Remote.h"
|
||||
#include "moses/Factor.h"
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
@ -42,7 +42,11 @@ bool LanguageModelRemote::start(const std::string& host, int port)
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
hp = gethostbyname(host.c_str());
|
||||
if (hp==NULL) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
fprintf(stderr, "gethostbyname failed\n");
|
||||
#else
|
||||
herror("gethostbyname failed");
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,15 @@
|
||||
#include "SingleFactor.h"
|
||||
#include "moses/TypeDef.h"
|
||||
#include "moses/Factor.h"
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user