我不明白我在哪里犯了错误。我的步骤:
安装 vscodium,msys2。更新 msys2 包,安装 clangd 扩展,CodeLLdb。
检查编译构建,工作。一切正常。
在项目中安装 SDL。树 -树项目
с_cpp_properties.json
{ "configurations": [ { "name": "Win32", "includePath": ["${workspaceFolder}/**", "${workspaceFolder}/SDL2/include/**", "${workspaceFolder}/SDL2/lib/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "compilerPath": "C:\\msys64\\clang64\\bin\\clang++.exe", "cStandard": "c11", "cppStandard": "c++17", "intelliSenseMode": "gcc-x64" } ], "version": 4 }
launch.json
{ // Use IntelliSense to understand related properties. // Hover to view the description of an existing property. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "LLDB: Generate and debug order files", "type": "lldb", "request": "launch", "program": "${workspaceFolder}\\debug.exe", "args": [], "stopOnEntry": false, "cwd": "${workspaceFolder}", "internalConsoleOptions": "neverOpen", "environment": [], "externalConsole": false, "preLaunchTask": "Clang++: Compile single file" }, { "name": "LLDB: Debug compiled debug.exe", "type": "lldb", "request": "launch", "program": "${workspaceFolder}\\debug", "args": [], "stopOnEntry": false, "cwd": "${workspaceFolder}", "internalConsoleOptions": "neverOpen", "environment": [], "externalConsole": false, } ] }
settings.json
{ "clangd.path": "clangd", }
tasks.json
{ "tasks": [ { "type": "shell", "label": "Clang++: Compile single file", "command": "C:\\msys64\\clang64\\bin\\clang++.exe", "args": [ "${fileDirname}\\${fileBasenameNoExtension}.cpp", "-o", "debug.exe", "-g", "-Wall", "-Wextra", "-stdlib=libc++", "-std=c++20", "-I F:/Сode/Project/SDL2/include", /*"-I F:\\Сode\\Project\\SDL2\\include",*/ "-L F:/Сode/Project/SDL2/lib", "-lmingw32", "-lSDL2main", "-lSDL2", "--target=x86_64-w64-mingw" ], "options": { "cwd": "${workspaceFolder}" }, "problemMatcher": ["$gcc"], "group": { "kind": "build", "isDefault": true }, "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, "detail": "Clang++: Compile a single file" }, ], "version": "2.0.0" }
Error `SDL2/SDL.h` not found, `clang(pp_file_not_found)`
我当然阅读了解决方法,sdl2
在msys2
. 但我想了解我做错了什么。