Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: boost and SFML  (Read 10070 times)

0 Members and 1 Guest are viewing this topic.

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
boost and SFML
« on: August 28, 2012, 12:10:53 am »
I am finally going to install boost and play with it.

I am using the BoostPro 1.51.0 Installer (32-bit) on a Windows 7 system with Visual studio 2010, and the installer gives several options for versions to install:
  • Multithreaded DLL
  • Multithreaded
  • Multithreaded, static runtime
  • Single threaded, static runtime
Is there a preferred version to use with SFML?

I am installing it now because I need a portable way of handling files, and boost::filesystem looks nice.
Are there other boost libraries you would recommend I install?
I only do small games and graphical applications, so nothing too complicated or sciencey  :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: boost and SFML
« Reply #1 on: August 28, 2012, 12:29:50 am »
Multithreaded DLL is the default, other variants should only be used in specific cases and when you know exactly what you do.
Laurent Gomila - SFML developer

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: boost and SFML
« Reply #2 on: August 28, 2012, 12:34:59 am »
...when you know exactly what you do.
Which I don't, so Multithreaded DLL it is. ;) Thanks Laurent!

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: boost and SFML
« Reply #3 on: August 28, 2012, 02:13:03 am »
I installed boost, but I can't get filesystem going. I get this error:
Quote
LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-gd-1_51.lib'
I looked at the documentation and searched the net, and there was some mention of setting the Path environment variable. I did tick the box in the installer to do so automatically, though.

Anyway, I tried adding the \boost_1_51 directory with no luck. Then \boost_1_51\lib, and then the directory containing \boost_1_51. Still no cigar.

Then I read somewhere that I would have to build bjam and then the libraries. I don't believe that makes sense, since libboost_filesystem-vc100-mt-gd-1_51.lib is already built and located in the \boost_1_51\lib directory, along with the .lib and .dll files for all the other libraries. Besides, isn't the whole point of the installer not having to build boost yourself?

So where do I go from here? I am at a loss.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: boost and SFML
« Reply #4 on: August 28, 2012, 03:44:36 am »
You must add the directory that contains the lib file (\boost_1_51\lib?) to the linker search paths, under your project settings.
Laurent Gomila - SFML developer

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: boost and SFML
« Reply #5 on: August 28, 2012, 04:06:38 am »
Yes, I tried that too, but without success. But I think I see what the problem is now:

The linker is looking for 'libboost_filesystem-vc100-mt-gd-1_51.lib', but the file in \boost_1_51\lib is named 'boost_filesystem-vc100-mt-gd-1_51.lib'.

Changing the name gives a new error that the linker can't find 'libboost_system-vc100-mt-gd-1_51.lib'. Does that mean I have to change all the file names to the correct format, or is there a better way?

Thank you for helping me, by the way!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: boost and SFML
« Reply #6 on: August 28, 2012, 09:38:02 am »
Well you can either change all the library names and add 'lib' OR you could just change the names you've entered in the project settings under Linker->Input to not having a 'lib' prefix. The linker will only search for libraries you've told it to search for. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: boost and SFML
« Reply #7 on: August 28, 2012, 11:18:51 am »
Well, the thing is that I hadn't entered anything in Additional Dependencies, fully expecting that other familiar linker error with the symbols.

I tried entering the lib file, as with other libraries, but that has no effect at all, so I am guessing the linker is being told to look for "libboost_..." with some fancy preprocessor command somewhere.

So now I have:
  • ...\boost_1_51 as an include directory
  • ...\boost_1_51\lib as a library directory
  • boost_filesystem-vc100-mt-gd-1_51.lib as an additional dependency in the linker settings
  • ...\boost_1_51 in the Path environment variable
I checked and double checked, and should be all set and ready to go, right?

All I get when I try to compile the code in the very first boost::filesystem tutorial is this:
Quote
1>------ Rebuild All started: Project: boost test, Configuration: Debug Win32 ------
1>Build started 8/28/2012 11:08:54 AM.
1>InitializeBuildStatus:
1>  Touching "Debug\boost test.unsuccessfulbuild".
1>ClCompile:
1>  main.cpp
1>LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-gd-1_51.lib'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:03.12
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: boost and SFML
« Reply #8 on: August 28, 2012, 11:34:05 am »
What do you include then?
If you setup an empty project and include only the header files needed for the library then there should not be any pragma comment calls or similar. And you'll have to add things on your own to the project settings to get everything working...
It's essentially the same as with SFML with the only difference in the library itself. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: boost and SFML
« Reply #9 on: August 28, 2012, 11:51:07 am »
What do you include then?

These are my include directives:
#include <iostream>
#include <boost/filesystem.hpp>

If you setup an empty project and include only the header files needed for the library then there should not be any pragma comment calls or similar. And you'll have to add things on your own to the project settings to get everything working...
It's essentially the same as with SFML with the only difference in the library itself. ;)
I don't think I understand what you mean exactly, but what I am doing here is pretty much similar to what I do when including SFML into a project. Except with SFML I don't add anything to the Path.

Also, SFML works out of the box, has a nice build system, plus a forum with actual support, and a responsible developer. I guess those are the main differences to boost. ;)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: boost and SFML
« Reply #10 on: August 28, 2012, 12:21:13 pm »
Except with SFML I don't add anything to the Path.

Also, SFML works out of the box, has a nice build system, plus a forum with actual support, and a responsible developer. I guess those are the main differences to boost. ;)
Well I didn't add boost to the PATH since I can add all of the needed info in the project settings.
What I did is just download boost's source, build it with bjam, add the path to the includes and to the libs to the project settings and added the needed libraries to the project settings; compiled and run. ;)

So it works also out of the box although the building system is not that nice...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: boost and SFML
« Reply #11 on: August 28, 2012, 12:42:18 pm »
Yeah, so maybe the BoostPro installer is just broken. Or maybe it's designed that way to get more customers for their support service? No, that's too evil..

How bad was the build process? I'm a bit scared of it... Do you know of a good, detailed, well structured step-by-step guide for the whole process?

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: boost and SFML
« Reply #12 on: August 28, 2012, 09:48:03 pm »
OK, I fixed it by renaming the files.

I don't imagine I will ever need to build boost on windows, so this solution will probably be OK for me.

Anyway, thanks for helping me, both of you! :)

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: boost and SFML
« Reply #13 on: September 02, 2012, 08:37:02 pm »
Aha!

I wrote to BoostPro, and it seems that dynamic library files are supposed to named differently in Windows. I will probably never know why, but to make auto-linking behave, you apparently have to define BOOST_ALL_DYN_LINK in the pre-processor.

I just thought I would mention this in case someone else has the same problem.