Я копирую этот код и компилирую его, но у меня есть какая-то ошибка
#include <thread>
#include <iostream>
struct F
{
void operator() () const
{
std::cout<<"Printing from another thread"<<std::endl;
}
};
int main()
{
F f;
std::thread t(f);
t.join();
return 0;
}
Ошибка: 'thread' is not a member of 'std'
Но я добавил "includePath" хорошо и "определяет" в "c_cpp_properties".json ", поэтому я не знаю, почему существуют ошибки.
" c_cpp_properties.json "выглядит так:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++",
"C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/mingw32",
"C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/backward",
"C:/MinGW/lib/gcc/mingw32/6.3.0/include",
"C:/MinGW/lib/gcc/mingw32/6.3.0/../../../../include",
"C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed",
"C:/MinGW/lib/gcc/mingw32/6.3.0/../../../../mingw32/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"__cdecl=__attribute__((__cdecl__))"
],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"${workspaceRoot}",
"C:/MinGW/lib/gcc/mingw32/6.3.0/include/",
"C:/MinGW/lib/gcc/mingw32/6.3.0/../../../../include",
"C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"compilerPath": "C:/mingw64/bin/g++.exe",
"cStandard": "c11",
"cppStandard": "c++11"
}
],
"version": 4
}
И" settings.json "похож на это (код-runner)
{
"git.autofetch": true,
"editor.wordWrap": "on",
"editor.suggestSelection": "first",
"java.home": "C:/Program Files/Java/jdk1.8.0_201/",
"workbench.settings.editor": "ui",
"code-runner.executorMap": {
"javascript": "node",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dirWithoutTrailingSlash && gcc $fileName -g -o $fileNameWithoutExt && ./$fileNameWithoutExt.exe",
//
//"cpp": "cd $dirWithoutTrailingSlash && g++ $fileName -g -o $fileNameWithoutExt && ./$fileNameWithoutExt.exe < d.dat",
"cpp": "cd $dirWithoutTrailingSlash && g++ $fileName -g -o $fileNameWithoutExt && $fileNameWithoutExt.exe",
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"php": "php",
"python": "python",
"perl": "perl",
"perl6": "perl6",
"ruby": "ruby",
"go": "go run",
"lua": "lua",
"groovy": "groovy",
"powershell": "powershell -ExecutionPolicy ByPass -File",
"bat": "cmd /c",
"shellscript": "bash",
"fsharp": "fsi",
"csharp": "scriptcs",
"vbscript": "cscript //Nologo",
"typescript": "ts-node",
"coffeescript": "coffee",
"scala": "scala",
"swift": "swift",
"julia": "julia",
"crystal": "crystal",
"ocaml": "ocaml",
"r": "Rscript",
"applescript": "osascript",
"clojure": "lein exec",
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
"racket": "racket",
"ahk": "autohotkey",
"autoit": "autoit3",
"dart": "dart",
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
"haskell": "runhaskell",
"nim": "nim compile --verbosity:0 --hints:off --run"
},
"code-runner.runInTerminal": true,
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"java.errors.incompleteClasspath.severity": "ignore",
}
Неправильно ли задан путь компиляции cpp в файле settings.json?Если я изменяю метод компиляции cpp в json-файле, чтобы комментировать, когда я нажимаю ctrl + alt + n, он идет так, как он был настроен.
Или лучше установить pthread?