Skip to content

Can't build for sfml v3.0.0 #2

@0x8BADFOOD

Description

@0x8BADFOOD

Default version sfml is 3.0.0 now.

brew list --versions sfml
sfml 3.0.0
➜  cloth_simulation git:(main) ✗ make
g++ -std=c++17 -I/opt/homebrew/Cellar/sfml/3.0.0/include -c main.cpp -o main.o
In file included from main.cpp:7:
./input_handler.h:16:19: error: no member named 'type' in 'sf::Event'
        if (event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Left) {
            ~~~~~ ^
./input_handler.h:16:57: error: expected '(' for function-style cast or type construction
        if (event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Left) {
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
./input_handler.h:16:66: error: no member named 'mouseButton' in 'sf::Event'
.....

Workaround

To make it work you need following.

1. Install version sfml2 (it is 2.6.2 now):

brew install sfml@2
brew list --versions sfml@2
sfml@2 2.6.2

2. Update make file:

-CXXFLAGS = -I/opt/homebrew/Cellar/sfml/2.6.1/include
-LDFLAGS = -L/opt/homebrew/Cellar/sfml/2.6.1/lib -lsfml-graphics -lsfml-window -lsfml-system
+CXXFLAGS = -I/opt/homebrew/Cellar/sfml@2/2.6.2/include
+LDFLAGS = -L/opt/homebrew/Cellar/sfml@2/2.6.2/lib -lsfml-graphics -lsfml-window -lsfml-system

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions