Undefined reference errors

I am using the code from here: https://github.com/MORTAL2000/Simple-Super-Mario-

I tried g++ -std=c++14 Affectors.cpp Command.cpp CommandQueue.cpp DataTables.cpp Enemy.cpp Entity.cpp Game.cpp Item.cpp Main.cpp ParticleNode.cpp Projectile.cpp SceneNode.cpp Tile.cpp TileMap.cpp Player.hpp World.cpp pugixml/pugixml.cpp -o main -I/home/Me/Downloads/SFML-2.4.2/include -L/home/Me/Downloads/SFML-2.4.2/lib -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio

And I get this error:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/tmp/ccx2Qfcv.o: In function `World::World(sf::RenderWindow&)':
World.cpp:(.text+0x4ba): undefined reference to `PlayerController::PlayerController()'
/tmp/ccx2Qfcv.o: In function `World::handleEvent(sf::Event const&)':
World.cpp:(.text+0x5cf): undefined reference to `PlayerController::handleEvent(sf::Event const&, CommandQueue&)'
World.cpp:(.text+0x6ec): undefined reference to `Player::applyTransformation(Player::Type)'
World.cpp:(.text+0x730): undefined reference to `Player::applyTransformation(Player::Type)'
World.cpp:(.text+0x76b): undefined reference to `Player::applyFireable()'
World.cpp:(.text+0x7a3): undefined reference to `Player::applyInvincible()'
/tmp/ccx2Qfcv.o: In function `World::update(sf::Time)':
World.cpp:(.text+0x8ea): undefined reference to `PlayerController::handleRealtimeInput(CommandQueue&)'
World.cpp:(.text+0x9b1): undefined reference to `Player::paused()'
/tmp/ccx2Qfcv.o: In function `std::_MakeUniq<Player>::__single_object std::make_unique<Player, Player::Type, ResourceHolder<sf::Texture, Textures::ID>&>(Player::Type&&, ResourceHolder<sf::Texture, Textures::ID>&)':
World.cpp:(.text._ZSt11make_uniqueI6PlayerJNS0_4TypeER14ResourceHolderIN2sf7TextureEN8Textures2IDEEEENSt9_MakeUniqIT_E15__single_objectEDpOT0_[_ZSt11make_uniqueI6PlayerJNS0_4TypeER14ResourceHolderIN2sf7TextureEN8Textures2IDEEEENSt9_MakeUniqIT_E15__single_objectEDpOT0_]+0x4e): undefined reference to `Player::Player(Player::Type, ResourceHolder<sf::Texture, Textures::ID> const&)'
/tmp/ccx2Qfcv.o: In function `Player::~Player()':
World.cpp:(.text._ZN6PlayerD2Ev[_ZN6PlayerD5Ev]+0xd): undefined reference to `vtable for Player'
World.cpp:(.text._ZN6PlayerD2Ev[_ZN6PlayerD5Ev]+0x19): undefined reference to `vtable for Player'
collect2: error: ld returned 1 exit status


how do I fix this?
Last edited on
Maybe replace your Player.hpp with Player.cpp

Topic archived. No new replies allowed.