2017-04-12 3 views
1

Je veux compiler kenlm sur OSX mais je reçois l'erreur:Pourquoi std :: move est-il indéfini alors que le compilateur est invoqué avec -std = C++ 11?

error: no member named 'move' in namespace 'std' 

Autres messages suggèrent de compiler avec

'-std=c++11'

mais je reçois toujours la même erreur. Comment puis-je résoudre ça?

g++ --version sorties:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 
Apple LLVM version 8.1.0 (clang-802.0.38) 
Target: x86_64-apple-darwin16.5.0 
Thread model: posix 
InstalledDir: /Library/Developer/CommandLineTools/usr/bin 

Le script de construction de kenlm ressemble à ceci:

from setuptools import setup, Extension 
import glob 
import platform 
import os 

#Does gcc compile with this header and library? 
def compile_test(header, library): 
    dummy_path = os.path.join(os.path.dirname(__file__), "dummy") 
    command = "bash -c \"g++ -include " + header + " -l" + library + " -x c++ - <<<'int main() {}' -o " + dummy_path + " >/dev/null 2>/dev/null && rm " + dummy_path + " 2>/dev/null\"" 
    return os.system(command) == 0 
... 

#We don't need -std=c++11 but python seems to be compiled with it now. https://github.com/kpu/kenlm/issues/86 
ARGS = ['-O3', '-DNDEBUG', '-DKENLM_MAX_ORDER=6', '-std=c++11'] 
ext_modules = [ 
    Extension(name='kenlm', 
     sources=FILES + ['python/kenlm.cpp'], 
     language='C++', 
     include_dirs=['.'], 
     libraries=LIBS, 
     extra_compile_args=ARGS) 
] 
... 

code à l'aide std::move:

#ifndef UTIL_FILE_STREAM_H 
#define UTIL_FILE_STREAM_H 
#include <utility> 
#include "util/fake_ostream.hh" 
#include "util/file.hh" 
#include "util/scoped.hh" 

#include <cassert> 
#include <cstring> 

#include <stdint.h> 

namespace util { 

class FileStream : public FakeOStream<FileStream> { 
    public: 
    explicit FileStream(int out = -1, std::size_t buffer_size = 8192) 
     : buf_(util::MallocOrThrow(std::max<std::size_t>(buffer_size, kToStringMaxBytes))), 
     current_(static_cast<char*>(buf_.get())), 
     end_(current_ + std::max<std::size_t>(buffer_size, kToStringMaxBytes)), 
     fd_(out) {} 

#if __cplusplus >= 201103L 
    FileStream(FileStream &&from) noexcept : buf_(std::move(from.buf_)), current_(from.current_), end_(from.end_), fd_(from.fd_) { 
     from.end_ = reinterpret_cast<char*>(from.buf_.get()); 
     from.current_ = from.end_; 
    } 
#endif 
+0

'g ++ --version'? – YSC

+0

ajouté à mon message – bear

+2

#include

Répondre