如何使用#include< random>在Mac上使用g ++? [英] How to use #include <random> with g++ on a Mac?

查看:104
本文介绍了如何使用#include< random>在Mac上使用g ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译一个从其他人那里获得的c ++程序。它是在Windows上开发的,g ++正在给出一些编译错误。其中之一是 $ b

I'm trying to compile a c++ program that I got from someone else. It's been developed on windows and g++ is giving some compile errors. One of them is with

#include <random>

其中给出以下错误: CandidateSolution.cpp:2:18:error :random:没有这样的文件或目录。我试图找到我可以从哪里得到error.h文件,但我找不到它。我怎样才能使它工作?

Which gives the following error: CandidateSolution.cpp:2:18: error: random: No such file or directory. I tried to find where I can get the error.h file from but I can't find it. How can I get this to work?

推荐答案

该标题是C ++ 11的新增功能。尝试使用 -std = c ++ 11 -std = c ++ 0x 。另外,请确保您的编译器是最新的。

That header is new to C++11. Try using -std=c++11 or -std=c++0x. Also, make sure your compiler is up to date.

这篇关于如何使用#include&lt; random&gt;在Mac上使用g ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆