问题 C1083:无法打开包含文件:"chrono":没有弹出此类文件或目录
Issue C1083: cannot open include file: 'chrono': no such file or directory pops out
我正在尝试编写一个程序,使6个数字随机出现。
这是我的。pro文件
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Lotto
TEMPLATE = app
CONFIG += c++11
SOURCES += main.cpp
mainwindow.cpp
lottogenerator.cpp
HEADERS += mainwindow.h
lottogenerator.h
FORMS += mainwindow.ui
我的。h文件
#ifndef LOTTOGENERATOR_H
#define LOTTOGENERATOR_H
#include <string>
#include <random>
#include <array>
#include <chrono>
class LottoGenerator
{
public:
typedef std::chrono::high_resolution_clock myclock;
LottoGenerator();
std::array<int, 6> get();
private:
int rand();
std::mt19937 *engine;
std::uniform_int_distribution<int> distribution;
myclock::time_point beginning = myclock::now();
};
#endif // LOTTOGENERATOR_H
这是我的。cpp文件
#include "lottogenerator.h"
LottoGenerator::LottoGenerator()
: distribution(1,45)
{
myclock::duration d = myclock::now() - beginning;
unsigned int seed = d.count();
engine.seed(seed);
}
std::array<int, 6> LottoGenerator::get()
{
std::array<int, 6> numbers;
numbers[0] = rand();
numbers[1] = rand();
numbers[2] = rand();
numbers[3] = rand();
numbers[4] = rand();
numbers[5] = rand();
return numbers;
}
int LottoGenerator::rand()
{
return distribution(engine);
}
,当我运行时,"C1083:不能打开包括文件:'chrono':没有这样的文件或目录"弹出。
如果你能帮忙的话,我将不胜感激。
您使用的MSVC版本太旧。
相关文章:
- 读取大文件(>2GB)(文本文件包含以太网数据)并通过不同参数随机访问数据的最佳方法是什么?
- C++文件包含多行
- CMake 如何强制third_party库将项目文件包含在当前项目源目录中?
- 是否可以将要"ShellExecute"的文件包含在 dll 中?如果是这样,"ShellExecute"中的文件位置应该是什么?
- C++ 逐行从文件(包含空格)读取数据
- 在 C++ 中,.h 文件包含文件但不起作用
- 生成的资源文件包含奇怪的包含文件
- 可变参数类的文件包含问题
- 为什么文件命令声明可执行文件包含"debug_info"
- 可以将标头文件包含在多个源文件中,而无需重复保护
- 为什么将.HPP文件包含在.h文件中
- Qt C++:将所有库文件包含在项目文件夹中
- 有条件地将文件包含在C++标头中
- 将多个原型文件包含在一个项目中会导致protobuf_AssignDescriptorsOnce()已经有一个主体
- 有没有办法将文件包含在C++中的所有项目文件中
- 将外部.asm文件包含到C++代码中
- 什么是"pch.h",为什么需要将其作为第一个头文件包含在内?
- 该头文件包含DirectX 12中的ThrowIfFailed()
- QT C :函数的多个定义当Header文件包含在MainWindow.h中时
- QT创建者错误地处理标头文件包含来自Directory