1
General / No member named 'make_unique' in namespace 'std' on Xcode
« on: October 21, 2021, 04:12:07 am »
Hi! I'm using SFML, is cool but I have this weird problem.
When I create a new project using default SFML template I'm not able to use "make_unuque" because it's not a member of "std".
But on an other project (inside an other folder but stil on my Mac, with Xcode) I can use it so I think that SFML template changes something on compiler version used by Xcode.
Before you ask me, yes I'm including memory as file header.
I also tried to add -std=c++14 to arguments passed on launch but it still doesn't work, also tried with including libraries like libstdc++ and libc++ maybe? I don't remember their names but should be these.
By the way this is the code :
#include <SFML/Graphics.hpp>
#include <iostream>
#include <memory>
// Here is a small helper for you! Have a look.
using namespace sf;
int main(int, char const**)
{
// Create the main window
RenderWindow window(VideoMode(503, 504), "8QueensPuzzle");
std::unique_ptr<int> ptr =std::make_unique<int>(); //error here
while (window.isOpen())
{
// Process events
Event event;
while (window.pollEvent(event))
{
// Close window: exit
if (event.type == Event::Closed) {
window.close();
}
// Escape pressed: exit
if (event.type == Event::KeyPressed && event.key.code == sf::Keyboard::Escape) {
window.close();
}
}
// Clear screen
window.clear();
window.display();
}
return EXIT_SUCCESS;
}
I'm running Xcode 13.0 on MacOS 11.6
When I create a new project using default SFML template I'm not able to use "make_unuque" because it's not a member of "std".
But on an other project (inside an other folder but stil on my Mac, with Xcode) I can use it so I think that SFML template changes something on compiler version used by Xcode.
Before you ask me, yes I'm including memory as file header.
I also tried to add -std=c++14 to arguments passed on launch but it still doesn't work, also tried with including libraries like libstdc++ and libc++ maybe? I don't remember their names but should be these.
By the way this is the code :
#include <SFML/Graphics.hpp>
#include <iostream>
#include <memory>
// Here is a small helper for you! Have a look.
using namespace sf;
int main(int, char const**)
{
// Create the main window
RenderWindow window(VideoMode(503, 504), "8QueensPuzzle");
std::unique_ptr<int> ptr =std::make_unique<int>(); //error here
while (window.isOpen())
{
// Process events
Event event;
while (window.pollEvent(event))
{
// Close window: exit
if (event.type == Event::Closed) {
window.close();
}
// Escape pressed: exit
if (event.type == Event::KeyPressed && event.key.code == sf::Keyboard::Escape) {
window.close();
}
}
// Clear screen
window.clear();
window.display();
}
return EXIT_SUCCESS;
}
I'm running Xcode 13.0 on MacOS 11.6