How to compile c ++ with SFML library within the project itself

1

Hello, people who like to program. I'm having a problem that until now researching in the donkey dad (Google) I could not solve. I am doing a little game as part of the evaluation of programming language 1. I do not know how to properly link (compile) the game, with the SFML library inside the project folder. I have installed SFML on linux (elementary) and am compiling directly for codeblocks, but I want to do a makefile to compile the project so that I can also use the library inside the project folder so that even those who do not have sfml installed on your computer can compile without problems. I know that when sfml is installed we compile more or less like this.

g++ -Wall src/main.cpp src/game.cpp -I include -o bin/app -lsfml-system -lsfml-window -lsfml-graphics

but of this geito only works if the library is installed in the system. Is there a way to make a lib folder and put SFML there and compile it? I hope my doubt has been clear. A hug to everyone.

    
asked by anonymous 30.09.2015 / 03:10

1 answer

1

Yes, just use the path of where is the lib you want to use with the -L + directory

g++ -Wall src/main.cpp src/game.cpp -I include -o bin/app -L lib/SFML-2.3.2 -lsfml-system -lsfml-window -lsfml-graphics

Just remembering that the libs should be distributed along with the binary if they are linked dynamically.

    
16.10.2015 / 04:20