Skip to content

SFML C++ project with Visual Studio Code setup for cross-platform development on Linux and Windows.

Notifications You must be signed in to change notification settings

ullaskunder3/sfml-vscode-soultion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VSCode SFML C++ Project Setup

This is a simple SFML C++ project running with vs code that can be built and run on both Linux and Windows using Visual Studio Code.

demo gif

Prerequisites

  • Visual Studio Code: Download and install Visual Studio Code
  • SFML Library:
    • Linux: Install SFML using your package manager. Example for Debian-based systems:

      sudo apt-get install libsfml-dev
      

      or (depends on which linux)

      sudo dnf -y install SFML
      
      • might need few tweaking
    • Windows: Download and install SFML from the official SFML website

      • GCC 13.1.0 MinGW (DW2) - 32-bit or
      • GCC 13.1.0 MinGW (SEH) - 64-bit

      dont messup check (64 or 32) bit properly

    • Extract the downloaded file and place it where ever you want remember the path

Setting up MinGW on Windows

  1. Install MinGW w64 (for Windows) using mingw-w64.org.

  2. Add the MinGW w64 bin directory to your system's PATH variable.

    • Example PATH addition: C:\mingw-w64\mingw64\bin (adjust the path based on your installation).
    • want's to know the difference between ming's 😄 link to repo

Setting up C++ on linux

  • Linux: Ensure you have GCC (GNU Compiler Collection) installed. Run the following commands to check the version and path:

    g++ --version
    which g++
    
    [dxlord.🐼] master (main)$ g++ --version
    
    g++ (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6)
    Copyright (C) 2023 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    [dxlord.🐼] master (main)$ which g++
    
    /usr/bin/g++
     

see it's too much that's why I use linux

Getting Started

  1. Clone the repository:
git clone https://github.com/ullaskunder3/sfml-vscode-soultion.git
cd <sfml-vscode-soultion>
  1. Open the project in Visual Studio Code.

  2. Install the required extensions: C/C++

  3. Configure IntelliSense:

  • Open .vscode/c_cpp_properties.json and update the paths for Windows/Linux users.
  • After checking path properly update it

Building and Running

Pressing Ctrl+Shift+B or running Tasks: Run Task from the global Terminal menu show the following picker pick Run C++ program with SFML

watch the program execute and run at the same time automatically

Screenshot from 2024-01-09 14-12-31 Screenshot from 2024-01-09 14-13-06
Screenshot from 2024-01-09 14-13-44

Troubleshooting

  • If you encounter any issues, ensure that you have the required dependencies installed and that the paths in .vscode/c_cpp_properties.json are correct.

  • For Windows users, make sure to update the paths in .vscode/c_cpp_properties.json with the correct MinGW or Visual Studio installation paths.

  • let me know if still need help

Contributing

Feel free to contribute to this project by opening issues or pull requests.

Happy coding!

About

SFML C++ project with Visual Studio Code setup for cross-platform development on Linux and Windows.

Topics

Resources

Stars

Watchers

Forks

Languages