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

Author Topic: problems with c++14  (Read 3016 times)

0 Members and 1 Guest are viewing this topic.

Voroz

  • Full Member
  • ***
  • Posts: 128
    • View Profile
problems with c++14
« on: October 11, 2015, 12:55:06 pm »
Hi!
I just upgraded to mingw 5.2 and trying to use LTBL2 which is using c++14 features, but when i try to compile i get "'make_unique' is not a member of 'std'"

I created a flag -std=c++14 in project build options -> compiler flags, and it doesn't complain about it. I tried changing to -std=c++16, and then it wouldn't run, so it does recognize the command.
So why do i still get this error?

Thanks.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: problems with c++14
« Reply #1 on: October 11, 2015, 01:22:30 pm »
So if you use -std=c++14 it worked? Then why do you try to use -std=c++16 which is no C++ standard?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Voroz

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: problems with c++14
« Reply #2 on: October 11, 2015, 01:25:15 pm »
So if you use -std=c++14 it worked? Then why do you try to use -std=c++16 which is no C++ standard?
No i mean that it doesn't work with -std=c++14. I just tried -std=c++16 to see if the compiler complained about that one, so i knew it actually recognized the -std=c++14 command.

Voroz

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: problems with c++14
« Reply #3 on: October 11, 2015, 01:29:26 pm »
By complain i mean that it actually told me that it doesn't recognize the command for -std=c++16. It doesn't say anything like that about -std=c++14, but it tells me that make_unique is not a member of std.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: problems with c++14
« Reply #4 on: October 11, 2015, 01:29:51 pm »
Did you use #include <memory>?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Voroz

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: problems with c++14
« Reply #5 on: October 11, 2015, 01:33:52 pm »
no, what's that supposed to do? Anyway i don't know why but when i checked the flag it was set to c++11 again, and then i changed it and now it works. I did set it to c++14 and rebuilt it and restarted it and it was set to c++14 multiple times when i tried running it, and i recreated the flag etc and it never worked. Suddenly now it works.. weird.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: problems with c++14
« Reply #6 on: October 11, 2015, 01:34:45 pm »
no, what's that supposed to do?
How do you think you can use standard library features? They're not just magically floating around in the aether ;)

Have a look at www.cppreference.com to see how to use a certain feature and what header to include.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Voroz

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: problems with c++14
« Reply #7 on: October 11, 2015, 01:38:40 pm »
I thought it was a member of stdlib. Although it's not my code, it's LTBL2 so everything necessary is supposed to be included already.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: problems with c++14
« Reply #8 on: October 11, 2015, 02:22:01 pm »
I thought it was a member of stdlib.
Yes, that's why you need to include its header.

Although it's not my code, it's LTBL2 so everything necessary is supposed to be included already.
That's not good practice. Include what you need yourself, don't rely on third-party headers to do it for you. If the implementation of LTBL2 changes, your code will break.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: problems with c++14
« Reply #9 on: October 11, 2015, 05:25:51 pm »
How do you think you can use standard library features? They're not just magically floating around in the aether ;)
They do and then it's called MSVC. :D