Portability and include fixes.

Add <cstdlib> include for srand()/rand(), and <unistd.h> for open() etc.
Include <unistd.h> on Windows if using MinGW.  Disable MeteorScorer on
Windows, since it doesn't have fork() and pipe().
This commit is contained in:
Jeroen Vermeulen 2015-04-10 12:54:34 +07:00
parent 0698da8b0f
commit 8a3ae2fd5c
4 changed files with 6 additions and 2 deletions

View File

@ -13,6 +13,8 @@
#include <iostream>
#include <string>
#include "util/unistd.hh"
#if defined(__GLIBCXX__) || defined(__GLIBCPP__)
#include <ext/stdio_filebuf.h>

View File

@ -18,6 +18,7 @@
#include "ScoreStats.h"
#include "Util.h"
#include "util/unistd.hh"
using namespace std;
@ -25,7 +26,7 @@ namespace MosesTuning
{
// Meteor supported
#if defined(__GLIBCXX__) || defined(__GLIBCPP__)
#if (defined(__GLIBCXX__) || defined(__GLIBCPP__)) && !defined(_WIN32)
// for clarity
#define CHILD_STDIN_READ pipefds_input[0]

View File

@ -1,3 +1,4 @@
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>

View File

@ -1,7 +1,7 @@
#ifndef UTIL_UNISTD_H
#define UTIL_UNISTD_H
#if defined(_WIN32) || defined(_WIN64)
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
// Windows doesn't define <unistd.h>
//