无法编译SFML C ++代码与从Visual Studio代码克++

问题描述 投票:-1回答:1

我试图编译在Visual Studio代码中的一些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}

我已经配置了以下this other question至极任务给了我这样的事情

{
"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 \包括\ SFML -LC:C:\ lib中\ SFML \ lib中-lsfml图形-lsfml窗口-lsfml系统

main.cpp中:1:24:致命错误:Graphics.hpp:没有这样的文件或目录汇编终止。与退出代码终止终端处理:1

(该问题的行简单地是#include <Graphics.hpp>

我有什么改变,使其工作?

谢谢

c++ windows visual-studio-code g++ sfml
1个回答
0
投票

从您的配置文件

"-IC:C:\\lib\\SFML\\include\\SFML",

你目前的路径在前面加一个额外的错误C:

该路径应

"-IC:\\lib\\SFML\\include\\SFML",

这错字是-L选项的一部分。

© www.soinside.com 2019 - 2024. All rights reserved.