SFML community forums

Help => General => Topic started by: DiegoWashed on October 10, 2013, 09:47:17 pm

Title: Do I have to "Set up" SFML everytime I want to open a new project?
Post by: DiegoWashed on October 10, 2013, 09:47:17 pm
At least for me, it took me weeks before I could get it working, I did the instalation process in so many ways and
so many times that now I am really confused about what I did to get it right, but it works! Im more in like
" dont touch it or it will get broken" state of mind, almost teared up when the big green circle compiled correctly
As I said I dont want to mess with the first succesful sfml set up, so I wanted to do another one, but
do I have to do the whole process again? it seems  that I need to link my files again, is there an option to just
copy what I did to another project?
I am using the newest Code blocks version and SFML 2.1 if that matters;
I know it is a small question but it would truly help me the long way!
Thanks!
Title: Re: Do I have to "Set up" SFML everytime I want to open a new project?
Post by: binary1248 on October 10, 2013, 10:06:58 pm
Either use the template I made a while back (no guarantee that it works): http://en.sfml-dev.org/forums/index.php?topic=10976.0

Or just spend 1 minute setting up your own project:
1. Create a new console application (yes console application, if you can't do this I can't help you), you can get rid of the console later if you want.
2. Open up the Project > Build Options.
You will have to do this per target (Debug, Release, etc.):
3. If and only if you want to link to the static version of SFML libraries, add SFML_STATIC to the empty page in the Compiler Settings > #defines tab.
4. In Linker Settings, add the libraries you need depending on what you use in your code. If you are using static libraries, add -s after the library name. If you are using debug libraries add -d after everything else (static debug would mean -s-d after the name). Beware of ordering (https://github.com/SFML/SFML/wiki/FAQ#wiki-build-link).
5. Write your code.

If you didn't set up your search directories yet, do so:
1. Open up Settings > Compiler.
2. In the Search Directories > Compiler tab add the full path to the sfml2/include folder.
3. In the Search Directories > Linker tab add the full path to the sfml2/lib folder.
Title: Re: Do I have to "Set up" SFML everytime I want to open a new project?
Post by: Josh_M on October 11, 2013, 03:05:37 am
You can save your current project as a template, which means you just select whatever you saved that template as for future projects. However it will have all your old files in it, so you might want to save a template with no files in it for simplicity. :)
Title: Re: Do I have to "Set up" SFML everytime I want to open a new project?
Post by: Clockwork on October 11, 2013, 06:48:39 am
Yeah, like Josh_M said, if you are using Visual Studio (2012 at least, not sure about earlier), than you can just save one of your projects as a template project. It's under File > Export Template.

That's what I use and it works like a charm.
Title: Re: Do I have to "Set up" SFML everytime I want to open a new project?
Post by: Laurent on October 11, 2013, 07:36:25 am
Or you do the complete setup again and again, so that you eventually understand it. Once understood, it takes 30 seconds (add include path, add lib path, add libs). Much less than the time you'll spend writing the application itself.
Title: Re: Do I have to "Set up" SFML everytime I want to open a new project?
Post by: DiegoWashed on October 11, 2013, 04:35:18 pm
Thanks a lot everyone for the quick answers!
I tried using the template and it works very well, thats what I was looking for, but I guess I do need to learn the "proper" way of setting
it up, anyway thanks again! ;D