SFML community forums

Help => Graphics => Topic started by: OUTSEET on September 25, 2022, 10:29:45 pm

Title: input handler not working
Post by: OUTSEET on September 25, 2022, 10:29:45 pm
i have 4 code:
input.hpp
input.cpp
core.hpp
main.cpp

tell me if you want a code

I have this error using vscode and MinGW:

g++ -Isrc/include -c coding/main.cpp
g++ main.o -o main -Lsrc/lib -lsfml-graphics -lsfml-window -lsfml-systemmain.o:main.cpp:(.text+0x1b9): undefined reference to `Input::InputHandler(sf::Event, sf::RenderWindow&)'
main.o:main.cpp:(.text+0x45c): undefined reference to `Input::Input()'
collect2.exe: error: ld returned 1 exit status
MakeFile:7: recipe for target 'link' failed
mingw32-make: *** [link] Error 1

Title: Re: input handler not working
Post by: kojack on September 26, 2022, 03:09:30 am
It's been a long time since I've used Mingw, but looks like you haven't compiled input.cpp and linked it with main.
Try something like this:
g++ -Isrc/include -c coding/main.cpp
g++ -Isrc/include -c coding/input.cpp
g++ input.o main.o -o main -Lsrc/lib -lsfml-graphics -lsfml-window -lsfml-system
Should be able to do it in less lines, but I'm rusty with G++.