Error: no instance of the overloaded function "std :: make_shared" matches the argument list

Looking at the Previous Stack Question from std: make_shared vs std :: shared_ptr, I tried to implement this in a uni project. This was the previous “question”:

I can’t think of a situation where

std::shared_ptr<Object> obj(new Object("foo", 1));

would be preferable

auto obj = std::make_shared<Object>("foo", 1);

So I took this code:

std::shared_ptr<Triangle> pT1(new Triangle(pCanvas, 30, 30, 30, 60, 60, 30, 255, 0, 0));

And changed it to this code:

auto pT1 = std::make_shared<Triangle>(pCanvas, 30, 30, 30, 60, 60, 30, 255, 0, 0);

However, std :: make_shared is underlined in red, and when I am above it, I get the error: "Error: no instance of the overloaded function" std :: make_shared "matches the argument list"

My code compiles and runs correctly with the first line of code, but if I use the second, there are some errors.

These errors are:

`1 > ------ : : SIT153Canvas, : Win32 ------ 1 > main.cpp

1 > c:\users\steve\documents\visual studio 2012\projects\sit153canvas\main.cpp(54): C2780: 'std:: shared_ptr < _Ty > std:: make_shared (_V0_t && &, _V1_t &, _V2_t & &, _V3_t &, _V4_t & &) ': 5 - 10

1 > c:\program files (x86)\microsoft visual studio 11.0\vc\include\memory (972): . 'std:: make_shared'

1 > c:\users\steve\documents\visual studio 2012\projects\sit153canvas\main.cpp(54): C2780: 'std:: shared_ptr < _Ty > std:: make_shared (_V0_t && &, _V1_t &, _V2_t &, _V3_t &) ': 4 - 10

1 > c:\program files (x86)\microsoft visual studio 11.0\vc\include\memory (972): . 'std:: make_shared'

1 > c:\users\steve\documents\visual studio 2012\projects\sit153canvas\main.cpp(54): C2780: 'std:: shared_ptr < _Ty > std:: make_shared (_V0_t && &, _V1_t &, _V2_t &) ': 3 - 10

1 > c:\program files (x86)\microsoft visual studio 11.0\vc\include\memory (972): . 'std:: make_shared'

1 > c:\users\steve\documents\visual studio 2012\projects\sit153canvas\main.cpp(54): C2780: 'std:: shared_ptr < _Ty > std:: make_shared (_V0_t && &, _V1_t &) ': 2 - 10

1 > c:\program files (x86)\microsoft visual studio 11.0\vc\include\memory (972): . 'std:: make_shared'

1 > c:\users\steve\documents\visual studio 2012\projects\sit153canvas\main.cpp(54): C2780: 'std:: shared_ptr < _Ty > std:: make_shared (_V0_t && & ) ': 1 - 10

1 > c:\program files (x86)\microsoft visual studio 11.0\vc\include\memory (972): . 'std:: make_shared'

1 > c:\users\steve\documents\visual studio 2012\projects\sit153canvas\main.cpp(54): C2780: 'std:: shared_ptr < _Ty > std:: make_shared (void)': 0 - 10

1 > c:\program files (x86)\microsoft visual studio 11.0\vc\include\memory (972): . 'std:: make_shared'

, std:: make_shared, , 5 . , , , . .

+4
1

VS2012 . - , 5 . _VARIADIC_MAX. .

+6

All Articles