Подключение c++ библиотеки в vscode

Не могу подключить SFML к проекту.

При сборке получаю ошибку:

> Executing task: g++ -g e:\cplus\sfml_proba\sfml_proba.cpp -o e:\cplus\sfml_proba\sfml_proba.exe -I E:\cplus\sfml_proba\libs\sfml\include <

C:\Users\pavlo\AppData\Local\Temp\ccKvRik6.o: In function `main':
e:/cplus/sfml_proba/sfml_proba.cpp:9: undefined reference to `__imp__ZN2sf6StringC1EPKcRKSt6locale'
e:/cplus/sfml_proba/sfml_proba.cpp:9: undefined reference to `__imp__ZN2sf9VideoModeC1Ejjj'
e:/cplus/sfml_proba/sfml_proba.cpp:9: undefined reference to `__imp__ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
e:/cplus/sfml_proba/sfml_proba.cpp:11: undefined reference to `__imp__ZN2sf11CircleShapeC1Efy'
e:/cplus/sfml_proba/sfml_proba.cpp:12: undefined reference to `__imp__ZN2sf5Color5GreenE'
e:/cplus/sfml_proba/sfml_proba.cpp:12: undefined reference to `__imp__ZN2sf5Shape12setFillColorERKNS_5ColorE'
e:/cplus/sfml_proba/sfml_proba.cpp:14: undefined reference to `__imp__ZNK2sf6Window6isOpenEv'
e:/cplus/sfml_proba/sfml_proba.cpp:9: undefined reference to `__imp__ZN2sf12RenderWindowD1Ev'
e:/cplus/sfml_proba/sfml_proba.cpp:9: undefined reference to `__imp__ZN2sf12RenderWindowD1Ev'
C:\Users\pavlo\AppData\Local\Temp\ccKvRik6.o: In function `sf::CircleShape::~CircleShape()':
E:/cplus/sfml_proba/libs/sfml/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `__imp__ZTVN2sf11CircleShapeE'
E:/cplus/sfml_proba/libs/sfml/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `__imp__ZTVN2sf11CircleShapeE'
E:/cplus/sfml_proba/libs/sfml/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `__imp__ZN2sf5ShapeD2Ev'
collect2.exe: error: ld returned 1 exit status
The terminal process terminated with exit code: 1

main.cpp:

#include <SFML\Graphics.hpp>
#include <iostream>

using namespace std;
using namespace sf;

int main()
{
    RenderWindow window( VideoMode(200, 200), "sfmltest");

    CircleShape circle(100.f);
    circle.setFillColor(Color::Green);

    while(window.isOpen())
    {

    }
    return 0;
}

tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "C/C++: g++.exe build active file",
            "command": "g++",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-I",
                "${workspaceFolder}\\libs\\sfml\\include"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/libs/sfml/include/SFML/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.17763.0",
            "compilerPath": "C:/MinGW64/mingw64/bin/g++.exe",
            "cStandard": "c18",
            "cppStandard": "c++20",
            "intelliSenseMode": "gcc-x64",
            "compilerArgs": []
        }
    ],
    "version": 4
}

Компилятор MinGW64.

В чем может быть проблема?


Ответы (0 шт):