2017-03-31 5 views

答えて

1

このコードをコンパイルするにはが必要です。

以下、私はC++ 11サポートなしでコンパイルしています(成功)。

Georgioss-MacBook-Pro:~ gsamaras$ g++ main.cpp 
main.cpp:14:20: error: no matching constructor for initialization of 
     'UserController' 
    UserController controller{ repo1, repo2 }; 
       ^
main.cpp:2:7: note: candidate constructor (the implicit copy constructor) not 
     viable: requires 1 argument, but 0 were provided 
class UserController 
    ^
main.cpp:8:5: note: candidate constructor not viable: requires 2 arguments, but 
     0 were provided 
    UserController(const Repo& r, const Repo& a) : repo(r), adoption(a) {} 
    ^
main.cpp:14:30: error: expected ';' at end of declaration 
    UserController controller{ repo1, repo2 }; 
          ^
          ; 
2 errors generated. 
Georgioss-MacBook-Pro:~ gsamaras$ g++ -std=c++0x main.cpp 
Georgioss-MacBook-Pro:~ gsamaras$ 
+0

私はVisual Studio 2013を使用していますので、C++ 11でコードをコンパイルしているかどうかはわかりません。それは1つの議論のために働くが、なぜそれが2つのために働かないのか分からない... – Xyntell

+1

心配しないで、私はそれを理解した。ありがとう! – Xyntell

+0

@Xyntellと?それが何だった? –

関連する問題