dimanche 27 août 2017

C++11 header files can't be found mingw-w64 Eclipse Oxygen?

I installed minGW-w64 on my Windows machine (the file I unzipped was called x86_64-7.1.0-release-posix-seh-rt_v5-rev2.zip, and I added the bin to my path already), and I'm using it with Eclipse. It works fine for almost everything, but it seems to run into issues with C++11 code. The code that's giving me errors is below.

#include <iostream>
#include <random>
using namespace std;

int main(){
    default_random_engine generator;
    normal_distribution<double> a(5.0,2.0);
    return 0;
}

Basically, Eclipse can't find the default_random_engine or normal_distribution. It finds the header file, but its the wrong header file, which I pasted below (the right one is here: http://ift.tt/2wB2HAy). How can I make Eclipse find the right file and have C++11 support?

#ifndef _GLIBCXX_RANDOM
#define _GLIBCXX_RANDOM 1

#pragma GCC system_header

#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else

#include <cmath>
#include <cstdlib>
#include <string>
#include <iosfwd>
#include <limits>
#include <debug/debug.h>
#include <type_traits>

#ifdef _GLIBCXX_USE_C99_STDINT_TR1

#include <cstdint> // For uint_fast32_t, uint_fast64_t, uint_least32_t
#include <bits/random.h>
#include <bits/opt_random.h>
#include <bits/random.tcc>

#endif // _GLIBCXX_USE_C99_STDINT_TR1

#endif // C++11

#endif // _GLIBCXX_RANDOM

Aucun commentaire:

Enregistrer un commentaire