1
General / Makefile cannot find -lsfml-XXX
« on: April 29, 2022, 09:21:03 am »
Hello everyone, I am trying to implement a Makefile for my SFML project but I am running in to the problem of not the compilator not being able to find -lsfml
This is my Makefile in which main.cpp and menu.cpp requires SFML
And this is the log output
Thank you for reading my question.
This is my Makefile in which main.cpp and menu.cpp requires SFML
all: main
LIBS=-lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system
#INCLUDE_PATHS specifies the additional include paths we'll need
INCLUDE_PATHS = -I/home/tp-home011/07423cc3-2cb5-4121-a984-6deee5e7a545/SFML-2.5.1/include
#LIBRARY_PATHS specifies the additional library paths we'll need
LIBRARY_PATHS = -I/home/tp-home011/07423cc3-2cb5-4121-a984-6deee5e7a545/SFML-2.5.1/lib
main: animal.o coord.o ensemble.o grille.o population.o jeu.o menu.o main.o
g++ -std=c++11 -Wall $(LIBRARY_PATHS) -o main animal.o coord.o ensemble.o grille.o population.o menu.o jeu.o main.o $(LIBS)
# fichiers objets
main.o: main.cpp
g++ -Wall -fexceptions -g $(INCLUDE_PATHS) -c main.cpp
animal.o: animal.cpp animal.hpp
g++ -std=c++11 -Wall -c animal.cpp
coord.o: coord.cpp coord.hpp
g++ -std=c++11 -Wall -c coord.cpp
ensemble.o: ensemble.cpp ensemble.hpp
g++ -std=c++11 -Wall -c ensemble.cpp
grille.o: grille.cpp grille.hpp
g++ -std=c++11 -Wall -c grille.cpp
population.o: population.cpp population.hpp
g++ -std=c++11 -Wall -c population.cpp
jeu.o: jeu.cpp jeu.hpp
g++ -std=c++11 -Wall -c jeu.cpp
menu.o: menu.cpp menu.hpp
g++ -Wall -fexceptions -g $(INCLUDE_PATHS) -c menu.cpp
test: test.o coord.o
g++ -o test test.o coord.o
test.o: test.cpp coord.hpp
g++ -std=c++11 -Wall -c test.cpp
clean:
rm -f *.o main
LIBS=-lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system
#INCLUDE_PATHS specifies the additional include paths we'll need
INCLUDE_PATHS = -I/home/tp-home011/07423cc3-2cb5-4121-a984-6deee5e7a545/SFML-2.5.1/include
#LIBRARY_PATHS specifies the additional library paths we'll need
LIBRARY_PATHS = -I/home/tp-home011/07423cc3-2cb5-4121-a984-6deee5e7a545/SFML-2.5.1/lib
main: animal.o coord.o ensemble.o grille.o population.o jeu.o menu.o main.o
g++ -std=c++11 -Wall $(LIBRARY_PATHS) -o main animal.o coord.o ensemble.o grille.o population.o menu.o jeu.o main.o $(LIBS)
# fichiers objets
main.o: main.cpp
g++ -Wall -fexceptions -g $(INCLUDE_PATHS) -c main.cpp
animal.o: animal.cpp animal.hpp
g++ -std=c++11 -Wall -c animal.cpp
coord.o: coord.cpp coord.hpp
g++ -std=c++11 -Wall -c coord.cpp
ensemble.o: ensemble.cpp ensemble.hpp
g++ -std=c++11 -Wall -c ensemble.cpp
grille.o: grille.cpp grille.hpp
g++ -std=c++11 -Wall -c grille.cpp
population.o: population.cpp population.hpp
g++ -std=c++11 -Wall -c population.cpp
jeu.o: jeu.cpp jeu.hpp
g++ -std=c++11 -Wall -c jeu.cpp
menu.o: menu.cpp menu.hpp
g++ -Wall -fexceptions -g $(INCLUDE_PATHS) -c menu.cpp
test: test.o coord.o
g++ -o test test.o coord.o
test.o: test.cpp coord.hpp
g++ -std=c++11 -Wall -c test.cpp
clean:
rm -f *.o main
And this is the log output
/usr/bin/ld : cannot find -lsfml-audio
/usr/bin/ld : cannot find -lsfml-graphics
/usr/bin/ld : cannot find -lsfml-window
/usr/bin/ld : cannot find -lsfml-system
collect2: error: ld returned 1 exit status
make: *** [Makefile:20 : main] Erreur 1
/usr/bin/ld : cannot find -lsfml-graphics
/usr/bin/ld : cannot find -lsfml-window
/usr/bin/ld : cannot find -lsfml-system
collect2: error: ld returned 1 exit status
make: *** [Makefile:20 : main] Erreur 1
Thank you for reading my question.