I am not allowed to initialise a tuple in C++. When I compile it comes up the following error while pointen at tuple
: no template named 'tuple'
. I am using Mac and have specified my tasks.json
as shown in the bottom of the page.
Code
#include <tuple>
#include <iostream>
using namespace std;
int main() {
tuple<int,int> f;
return 0;
}
Error message:
error: no template named 'tuple'
tuple<int,int> f;
^
1 error generated.
tasks.json (taken from https://code.visualstudio.com/docs/cpp/config-clang-mac where I have followed their guidelines):
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-stdlib=libc++",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
},
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
]
}
Compiler
% clang --version
Apple clang version 11.0.3 (clang-1103.0.32.59)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
question from:
https://stackoverflow.com/questions/65920834/no-template-named-tuple-in-c 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…