我遇到了在Ubuntu 16.04 LTS(服务器)上编译的问题.如果我不包括该-std=c++11位,它编译好.Clang版本是3.8.
>cat foo.cpp
#include <string>
#include <iostream>
using namespace std;
int main(int argc,char** argv) {
string s(argv[0]);
cout << s << endl;
}
>clang++ -std=c++11 -stdlib=libc++ foo.cpp
In file included from foo.cpp:1:
/usr/include/c++/v1/string:1938:44: error: 'basic_string<_CharT, _Traits, _Allocator>' is missing exception specification
'noexcept(is_nothrow_copy_constructible<allocator_type>::value)'
basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
^
/usr/include/c++/v1/string:1326:40: note: previous declaration is here
_LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a)
^
1 error generated.
Run Code Online (Sandbox Code Playgroud) 为了更好地理解terraform,我希望能够将HCL转换为等效的JSON。我有HCL解析器(https://github.com/hashicorp/hcl)可以构建并可以运行测试,但是我看不到任何命令可以接收HCL文件并输出JSON。
有一个HCL的python实现,它包含一个将HCL转换为JSON的实用程序,但是它具有一些相当奇怪/意外的行为,我想确认该行为来自HCL语言,并且不特定于python实现。例如
> cat foo.tf
service {
key = "aaa"
}
service {
key = 0x10
foo = "bar"
}
> hcltool foo.tf
{
"service": [
{
"foo": "bar",
"key": "aaa"
},
{
"key": 16
}
]
}
Run Code Online (Sandbox Code Playgroud)