Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: input handler not working  (Read 1496 times)

0 Members and 1 Guest are viewing this topic.

OUTSEET

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
input handler not working
« 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


kojack

  • Sr. Member
  • ****
  • Posts: 343
  • C++/C# game dev teacher.
    • View Profile
Re: input handler not working
« Reply #1 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++.