我有以下 Terraform 资源,旨在为每个仓库创建一个单独的加密 EFS 卷,然后在两个子网中为每个创建挂载目标:
resource "aws_efs_file_system" "efs-data-share" {
count = "${length(var.warehouses)}"
encrypted = "${var.encrypted}"
kms_key_id = "${element(data.aws_kms_key.encryption_key.*.arn,count.index)}"
performance_mode = "${var.performance_mode}"
tags {
Name = "${element(split(".",var.warehouses[count.index]),0)}-${var.name_suffix}"
Warehouse = "${element(split(".",var.warehouses[count.index]),0)}"
Environment = "${var.environment}"
Purpose = "${var.purpose}"
}
}
resource "aws_efs_mount_target" "mounts" {
count = "${length(var.subnets)}"
file_system_id = "${aws_efs_file_system.efs-data-share.*.id}"
subnet_id = "${element(var.subnets, count.index)}"
security_groups = ["${var.efs_security_groups}"]
}
data "aws_kms_key" "encryption_key" {
count = "${length(var.warehouses)}"
key_id = "alias/${element(split(".",var.warehouses[count.index]),0)}-${var.key_alias_suffix}"
}
Run Code Online (Sandbox Code Playgroud)
EFS 本身启动正常,但挂载失败,因为 file_system_id 必须是单个资源,而不是列表。
* module.prod_multi_efs.aws_efs_mount_target.mounts[1]: file_system_id must be a single value, not a …Run Code Online (Sandbox Code Playgroud) 我正在尝试编译一些使用该行的代码:
Sleep(10);
Run Code Online (Sandbox Code Playgroud)
在我的IDE中,我所要做的就是写:
using namespace std;
Run Code Online (Sandbox Code Playgroud)
要么
#include <unistd.h>
Run Code Online (Sandbox Code Playgroud)
它编译好!
但是,在Linux上通过命令行进行编译时,一切都不正常.编译器告诉我这Sleep是未定义的.我编译使用:
g++ -lglut -lGL -lm -o PROGRAM.exe PROGRAM.cpp
Run Code Online (Sandbox Code Playgroud)
我写的其他代码不使用Sleep这种编译方式.
我需要向链接器(with -l)提供哪些库才能Sleep识别该函数?
我正在尝试在 OpenGL 中制作一个带有圆角的立方体,如果你要打磨角,那么就像一个模具,或者那些新奇的填充椅子之一。
据我了解,贝塞尔曲线似乎是解决此问题的最佳方法,但我确定如何将它们缝合在一起以形成我想要的立方体。我已经成功地将两条贝塞尔曲线放在一起,形成了一个“扁鱼状”三角形实体(参见下面的代码),但每当我尝试将其扩展到立方体时,我总是会得到一些奇怪的非凸令人厌恶的东西。
//Draw left side of fish
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, &ctrlptsLeft[0][0][0]);
glMapGrid2f(uSteps, 0.0, 1.0, vSteps, 0.0, 1.0);
glEvalMesh2(GL_FILL, 0, uSteps, 0, vSteps);
//Draw right side of fish
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, &ctrlptsRight[0][0][0]);
glMapGrid2f(uSteps, 0.0, 1.0, vSteps, 0.0, 1.0);
glEvalMesh2(GL_FILL, 0, uSteps, 0, vSteps);
/* uSteps and vSteps are defined elsewhere as constants - the number of steps to use in drawing the surface. Likewise, the control point …Run Code Online (Sandbox Code Playgroud) 我已经定义了一个Player类来进行一些操作,所以我可以方便地重载一些基本操作符.具体来说,我想使用<用于Player对象之间的比较.因此,我在课堂上有以下内容:
bool operator<(const Player& rhs) const {return (*this < rhs );}
Run Code Online (Sandbox Code Playgroud)
不幸的是,这导致了问题.后来,当我尝试在main函数中输出包含特定元素的向量时,编译器让我知道<< operand没有匹配,并且它需要std :: ostream << Player.以下是导致问题的一行:
vector<Player> playerVec(6);
for (int i = 0; i < 6; i++) {
cout << playerVec[i];
}
Run Code Online (Sandbox Code Playgroud)
请注意,我实际上并不想直接输出任何Player对象流,所以我认为我不需要重载<<.
我对发生的事情有一些了解,因为编译器采用了我的特定定义<然后不打算寻找更一般的情况.我的问题是,我现在需要重载<<运算符以返回其一般功能,还是有更简单的解决方案?
感谢您提供的任何帮助!