Author Topic: #include <algorithm> usage  (Read 7125 times)

Offline RogerBennett

  • Sergeant
  • **
  • Posts: 16
    • View Profile
#include <algorithm> usage
« on: February 13, 2016, 04:33:23 pm »

Guys, I've had to include <algorithm> to a bunch of files for min, max, transform, foreach.
Have I missed a trick?
How does this work for anybody else?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9089
    • View Profile
Re: #include <algorithm> usage
« Reply #1 on: February 13, 2016, 05:45:57 pm »
I guess it's because you are using a more recent version of yaml-cpp than the devs.

Offline RogerBennett

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: #include <algorithm> usage
« Reply #2 on: February 13, 2016, 10:58:45 pm »
OK
I must have missed the instructions
I grabbed from here
https://github.com/jbeder/yaml-cpp

Is there a fixed version for YAML, and for SDL, SDL_mixer, SDL_image and SDL_gfx I should be using?
Once I got all those built, I get an YAML unresolved external, so I was pretty sure I had the wrong version and/or a header/library mismatch.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: #include <algorithm> usage
« Reply #3 on: February 13, 2016, 11:12:02 pm »
The standard version of a fresh yaml-cpp clone (which defaults to "master") needs C++11,  OXC is not fully compatible with that version (if i understood the forum posts correct).

You will need to checkout a tagged commit before building your yaml version:
Code: [Select]
git checkout release-0.5.3You can opt for older versions .. as long as you treat 0.5.2 as a primed proximity grenade ;)

Good luck

Offline RogerBennett

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: #include <algorithm> usage
« Reply #4 on: February 13, 2016, 11:24:49 pm »
Aces thanks.
cmake 0.5.3 gives me boost errors, so I'll work through those and carry on trying. I can't be too far off.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: #include <algorithm> usage
« Reply #5 on: February 14, 2016, 12:07:24 am »
You are getting close indeed.

According to the linux part of the build instructions libboost and xmlto are also needed.
And unless you want to do some work on SDL2 compatibility it is wise to use the 1.2 versions of the SDL libs.

Offline RogerBennett

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: #include <algorithm> usage
« Reply #6 on: February 14, 2016, 12:46:40 pm »
Thanks for the encouragement.

If SDL 1.2.* is sufficient then I should be fine then. I'll read the SDL2 specifications and check there is nothing there I'm going to need, as far as I know I'll be fine. The 1.2 spec looks like it has enough input, timing, and OpenGL is already an option so I'll be fine on that side.

FYI - That build instructions link doesn't open for me. I just get a database error for everything from https://www.ufopaedia.org/
My problem is Yaml-CPPs CMake is missing a path to my boost libs - I just need to learn where to set BOOST_ROOT and I could be golden.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: #include <algorithm> usage
« Reply #7 on: February 15, 2016, 03:05:00 pm »
FYI - That build instructions link doesn't open for me. I just get a database error for everything from https://www.ufopaedia.org/
Oh yes apparently the website is down for the moment. Meanwhile you could try using the cached versions of your favorite search engine.

My problem is Yaml-CPPs CMake is missing a path to my boost libs - I just need to learn where to set BOOST_ROOT and I could be golden.
Hmm, i am not sure which OS you are using, but in my case installing boost was enough to make it visible to YAML-CPP (did you forget to rerun CMake to make it pickup the new libraries?)

Offline RogerBennett

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: #include <algorithm> usage
« Reply #8 on: February 16, 2016, 11:31:08 am »
Thanks!

I got boost and yaml-cpp to build, but following an unresolved external in yaml::node while linking OpenXcom I decided to download the prebuilt libs.
I'm building for Win32.

I kind of feel like I've failed at the first hurdle, but at least I can write code and run the game which is all I was after. My Algorithm #include was caused by a mismatch in my yaml-cpp version.

Either way, I'm up and running. I didn't get time to write any features yet but I'll post a separate thread.
Cheers.

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: #include <algorithm> usage
« Reply #9 on: February 16, 2016, 06:53:56 pm »
`yaml::node` is trash that you should ignore. Recent yaml-cpp commit removed it.