Search code examples
c++windowssfmlclion

Installing SFML in CLion on windows


I got SFML installed in CLion but i am running into some issues when i try to run some basic code to see if it works properly.

#include <SFML/Window.hpp>
int main()
{
    sf::Window window(sf::VideoMode(800, 600), "My window");

    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }

    return 0;
}

this has no errors but it does not work properly,i get this when i run itProcess finished with exit code -1073741515 (0xC0000135). Any ideas on how this could be fixed? enter image description here this is a picture of the code if it helps you

also,here is my cmake file enter image description here


Solution

  • For your linker flags, you need to add sfml-window and sfml-system.