如何在 Visual Studio Code 中链接 SFML 库?

Jas*_*son 6 sfml visual-studio-code

我已经尝试了几个小时,但似乎无法做到我已经下载了扩展程序并寻求帮助,但此时一切都让我感到困惑。我想在我的项目中包含 SFML 库,我正在尝试使用 Visual Studio Code 编辑器,但由于某种原因它不会遵守。

它目前的样子的图片。 http://imgur.com/qJPlJua

我昨天也已经尝试了几个小时,但它只是不想工作。

小智 1

我搜索并找到了解决方案。

\n

tasks.json文件中,定义两个任务:

\n
"tasks": [\n    { \n        "taskName": "Compilation",\n        "isBuildCommand": true,\n        "args": ["-c", "${workspaceRoot}\\\\main.cpp", "-IC:\\\\SFML-2.4.0\\\\include"]\n    },\n    { \n        "taskName": "Liaison du fichier compil\xc3\xa9 aux biblioth\xc3\xa8ques SFML",\n        "args": ["${workspaceRoot}\\\\main.o", "-o", "sfml-app.exe", "-LC:\\\\SFML-2.4.0\\\\lib", "-lsfml-graphics", "-lsfml-window", "-lsfml-system"]\n    }\n],\n
Run Code Online (Sandbox Code Playgroud)\n

并添加"suppressTaskName": true,

\n

所以就像在 Linux 上一样。

\n

使用 CTRL + SHIFT + B 进行编译。要创建 .exe 文件: CTRL+SHIFT+P --> 然后“运行任务”,然后单击“Liaison du fichier compil\xc3\xa9 aux\nbiblioth\xc3\xa8ques SFML” “ 任务。

\n

整个文件如下(对我来说):

\n
{\n// See https://go.microsoft.com/fwlink/?LinkId=733558\n// for the documentation about the tasks.json format\n"version": "0.1.0",\n"command": "g++",\n"isShellCommand": true,\n"suppressTaskName": true,\n"tasks": [\n    { \n        "taskName": "Compilation",\n        "isBuildCommand": true,\n        "args": ["-c", "${workspaceRoot}\\\\main.cpp", "-IC:\\\\SFML-2.4.0\\\\include"]\n    },\n    { \n        "taskName": "Liaison du fichier compil\xc3\xa9 aux biblioth\xc3\xa8ques SFML",\n        "args": ["${workspaceRoot}\\\\main.o", "-o", "sfml-app.exe", "-LC:\\\\SFML-2.4.0\\\\lib", "-lsfml-graphics", "-lsfml-window", "-lsfml-system"]\n    }\n],\n"showOutput": "always"\n}\n
Run Code Online (Sandbox Code Playgroud)\n