[hunter@localhost Winter Wasteland]$ make
** Building the game
g++ -o WinterWasteland src/main.o src/Knife.o src/Player.o src/Snowpile.o src/Tree.o src/Weapon.o src/Snowflake.o -std=c++11 -lsfml-graphics -lsfml-window -lsfml-system
src/main.o: In function `main':
main.cpp:(.text+0x945): undefined reference to `sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'
src/Player.o: In function `Player::Player(sf::Vector2<float>, PlayerDirection, PlayerAimDirection, float, int, int)':
Player.cpp:(.text+0xea): undefined reference to `sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'
src/Snowpile.o: In function `Snowpile::Snowpile(sf::Vector2<float>, int)':
Snowpile.cpp:(.text+0x91): undefined reference to `sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'
src/Tree.o: In function `Tree::Tree(sf::Vector2<float>, int)':
Tree.cpp:(.text+0xfd): undefined reference to `sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'
Tree.cpp:(.text+0x185): undefined reference to `sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'
src/Weapon.o:Weapon.cpp:(.text+0x5d3): more undefined references to `sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)' follow
src/Weapon.o: In function `Enemy::~Enemy()':
Weapon.cpp:(.text._ZN5EnemyD2Ev[_ZN5EnemyD5Ev]+0x13): undefined reference to `vtable for Enemy'
src/Snowflake.o: In function `Snowflake::Snowflake(sf::Vector2<float>, int, int, sf::Vector2<float>)':
Snowflake.cpp:(.text+0xd5): undefined reference to `sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'
collect2: error: ld returned 1 exit status
makefile:31: recipe for target 'winterwasteland' failed
make: *** [winterwasteland] Error 1
CXX := g++
CXXFLAGS:=-std=c++11
LIBS= -lsfml-graphics -lsfml-window -lsfml-system
all: winterwasteland
main.o: src/main.cpp
$(CXX) -c $(CXXFLAGS) "src/main.cpp" -o src/main.o
Knife.o: src/Knife.cpp src/Knife.h
$(CXX) -c $(CXXFLAGS) "src/Knife.cpp" -o src/Knife.o
Player.o: src/Player.cpp src/Player.h
$(CXX) -c $(CXXFLAGS) "src/Player.cpp" -o src/Player.o
Snowpile.o: src/Snowpile.cpp src/Snowpile.h
$(CXX) -c $(CXXFLAGS) "src/Snowpile.cpp" -o src/Snowpile.o
Tree.o: src/Tree.cpp src/Tree.h
$(CXX) -c $(CXXFLAGS) "src/Tree.cpp" -o src/Tree.o
Weapon.o: src/Weapon.cpp src/Weapon.h
$(CXX) -c $(CXXFLAGS) "src/Weapon.cpp" -o src/Weapon.o
winterwasteland: src/main.o src/Knife.o src/Player.o src/Snowpile.o src/Tree.o src/Weapon.o src/Snowflake.o
@echo "** Building the game"
$(CXX) -o WinterWasteland src/main.o src/Knife.o src/Player.o src/Snowpile.o src/Tree.o src/Weapon.o src/Snowflake.o $(CXXFLAGS) $(LIBS)
[hunter@localhost ~]$ ldconfig -p | grep sfml
libsfml-window.so.2.3 (libc6,x86-64) => /lib64/libsfml-window.so.2.3
libsfml-window.so.2.3 (libc6) => /lib/libsfml-window.so.2.3
libsfml-window.so (libc6,x86-64) => /lib64/libsfml-window.so
libsfml-window.so (libc6) => /lib/libsfml-window.so
libsfml-system.so.2.3 (libc6,x86-64) => /lib64/libsfml-system.so.2.3
libsfml-system.so.2.3 (libc6) => /lib/libsfml-system.so.2.3
libsfml-system.so (libc6,x86-64) => /lib64/libsfml-system.so
libsfml-system.so (libc6) => /lib/libsfml-system.so
libsfml-network.so.2.3 (libc6,x86-64) => /lib64/libsfml-network.so.2.3
libsfml-network.so.2.3 (libc6) => /lib/libsfml-network.so.2.3
libsfml-network.so (libc6,x86-64) => /lib64/libsfml-network.so
libsfml-network.so (libc6) => /lib/libsfml-network.so
libsfml-graphics.so.2.3 (libc6,x86-64) => /lib64/libsfml-graphics.so.2.3
libsfml-graphics.so.2.3 (libc6) => /lib/libsfml-graphics.so.2.3
libsfml-graphics.so (libc6,x86-64) => /lib64/libsfml-graphics.so
libsfml-graphics.so (libc6) => /lib/libsfml-graphics.so
libsfml-audio.so.2.3 (libc6,x86-64) => /lib64/libsfml-audio.so.2.3
libsfml-audio.so.2.3 (libc6) => /lib/libsfml-audio.so.2.3
libsfml-audio.so (libc6,x86-64) => /lib64/libsfml-audio.so
libsfml-audio.so (libc6) => /lib/libsfml-audio.so
Show the ones without demangle too.
Weapon.cpp:(.text._ZN5EnemyD2Ev[_ZN5EnemyD5Ev]+0x13): undefined reference to `vtable for Enemy'
There is same symbol in .so as in the .o . It's strange this happens. Does a single file that just loads a Texture link?
You also have an error in your code BTW, one of these cryptic linker ones where you miss a destructor or virtual keyword or something:QuoteWeapon.cpp:(.text._ZN5EnemyD2Ev[_ZN5EnemyD5Ev]+0x13): undefined reference to `vtable for Enemy'
#include <SFML/Graphics.hpp>
int main()
{
sf::Texture tex;
tex.loadFromFile("some-image.png");
}
There is something wrong with your makefile then. You shouldn't need to delete outdated files yourself. You rely on .o files for linking, not on the targets that build these .o files so these targets can't replace outdated .o files to link the app. Maybe you should have src/ in names of the .o targets too?