我正在尝试在 Visual Studio Code 中编译一些 C++ 代码,但我想使用 SFML 库,但由于某种原因它找不到我的库。我正在使用 c/c++ 扩展,其配置如下
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**", "C:\\lib\\SFML\\include\\**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\TDM-GCC-64\\bin\\g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4}
{
"version": "2.0.0",
"tasks":
[
{
"label": "Compilation",
"type": "shell",
"group": "build",
"command": "g++",
"args":
[
"main.cpp",
"-o",
"GUImeOfLife.exe",
"-IC:C:\\lib\\SFML\\include\\SFML",
"-LC:C:\\lib\\SFML\\lib",
"-lsfml-graphics",
"-lsfml-window",
"-lsfml-system"
],
"problemMatcher": "$gcc"
}
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": true
}}
但是,当我在我的代码(只是来自 SFML 库网站的示例代码)上运行任务时,我从编译器收到此消息:
执行任务:g++ main.cpp -o GUImeOfLife.exe -IC:C:\lib\SFML\include\SFML -LC:C:\lib\SFML\lib -lsfml-graphics -lsfml-window -lsfml-system
main.cpp:1:24: 致命错误: Graphics.hpp: 没有这样的文件或目录编译终止。终端进程以退出代码终止:1
(有问题的线路就是#include <Graphics.hpp>
)
我必须改变什么才能使它工作?
谢谢
从您的配置文件
"-IC:C:\\lib\\SFML\\include\\SFML",
您提供的路径C:
前面添加了一个额外的错误。
路径应该是
"-IC:\\lib\\SFML\\include\\SFML",
这个错字也是-L
选项的一部分。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句