Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i link the SFML libraries in Visual Studio Code?

I've been trying for hours and I can't seem to do it I've downloaded extensions and asked for help around but everything is just confusing me at this point. I want to include the SFML libs in my project and I'm trying to use the the Visual Studio Code editor for it but it just won't comply for some reason.

A picture of what it currently looks like. http://imgur.com/qJPlJua

I've been trying this for hours yesterday also but it just doesn't want to work.

like image 727
Jason Avatar asked Jul 15 '16 20:07

Jason


People also ask

How do I add SFML to Visual Studio?

Installing SFML First, you must download the SFML SDK from the download page. You must download the package that matches your version of Visual C++. Indeed, a library compiled with VC++ 10 (Visual Studio 2010) won't be compatible with VC++ 12 (Visual Studio 2013) for example.

How do I add a library to the visual code?

Start Visual Studio Code. In the Open Folder dialog, create a ClassLibraryProjects folder and click Select Folder (Open on macOS). Open the Terminal in Visual Studio Code by selecting View > Terminal from the main menu. The Terminal opens with the command prompt in the ClassLibraryProjects folder.

How do I link SFML to code blocks?

Click on your project name “Project” . In Project/Linker settings/Link libraries click on “Add” and add “sfml-graphics”, “sfml-window” and “sfml-system”. In Project/Search directories/Compiler click on Add and add “C:\SFML-2.3\include”. In Project/Search directories/Linker add “C:\SFML-2.3\lib”.


1 Answers

I know the topic is a couple years old now but since I was searching for a way to link the sfml lib in vs code and I first ended up here, I thought I would share this git repo I found, which works pretty well for me so far:

https://github.com/andrew-r-king/sfml-vscode-boilerplate

I'm not using SFML 2.5.1 though, so I had to bring a small change in the c_cpp_properties.json file (I am on Ubuntu 18.04 and installed sfml through package manager)

here my c_cpp_properties.json file:

{
    "configurations": [
        {
            "name": "Linux",
            "intelliSenseMode": "gcc-x64",
            "includePath": [
                "${workspaceFolder}/src",
                "/usr/local/include/**",
                "/usr/include/**"
            ],
            "defines": [],
            "cStandard": "c11",
            "cppStandard": "c++17",
            "forcedInclude": [
                "${workspaceFolder}/src/PCH.hpp"
            ]
        }
    ],
    "version": 4
}
like image 58
grybouilli Avatar answered Nov 15 '22 10:11

grybouilli