我正在尝试安装 SFML 并将其包含到我的 VS 代码中,我也是一个绝对的初学者。 我查了几个关于这个主题的视频,但没有帮助。
我尝试运行的代码是来自 SFML 网站的示例代码。
这是我的 task.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: cpp.exe Aktive Datei kompilieren",
"command": "C:\\MinGW\\bin\\cpp.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"-O2",
"-DNDEBUG",
"-ggdb",
"-pedantic-errors",
"-Werror",
"-Wall",
"-Weffc++",
"-Wextra",
"-Wsign-conversion",
"-std=c++20",
"-Wconversion",
"-IC:\\Users\\amirf\\Documents\\libraries\\SFML-2.5.1\\include\\SFML",
"-LC:\\Users\\amirf\\Documents\\libraries\\SFML-2.5.1\\lib",
"-lsfml-window",
"-lsfml-graphics",
"-lsfml-system",
"-lsfml-audio",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Vom Debugger generierte Aufgabe."
}
],
"version": "2.0.0"
}
但是,如果我尝试包含一个 sfml 库,我总是得到:致命错误:SFML/Graphics.hpp:没有这样的文件或目录
我查看了堆栈溢出中关于该主题的其他问题,但所有有用的答案都包含在 task.json 中的路径,我认为我已经这样做了