makefile has error when commands work on their own

makefile has error when commands work on their own

by Jasper Kranias -
Number of replies: 4
When I use each command in my makefile manually in the terminal (Mac) everything runs fine, but when I use make it gives the warning:
 
warning: alias declarations are a C++11 extension [-Wc++11-extensions]

using Cells = std::unique_ptr<bool[]>;

and the errors:

init.cpp:10:21: error: no member named 'make_unique' in namespace 'std'

    Cells cell(std::make_unique<bool[]>(num_cells));

               ~~~~~^

init.cpp:10:37: error: expected '(' for function-style cast or type construction

    Cells cell(std::make_unique<bool[]>(num_cells));


does anyone have any idea why the makefile would cause these errors when the commands themselves don't?

In reply to Jasper Kranias

Re: makefile has error when commands work on their own

by Ramses van Zon -
You need to tell your compiler to use the C++17 standard. See the example on slide 24 of lecture 5.
In reply to Jasper Kranias

Re: makefile has error when commands work on their own

by Jagdeep Singh -
Unique ptr is not available in C++11
In reply to Jagdeep Singh

Re: makefile has error when commands work on their own

by Ramses van Zon -
It's actually make_unique that is not available in c++11, but it is in c++17, which is what, you are supposed to use. With g++, this can be set by adding the -std=c++17 flag.