TriMickTri / elements-of-programming-interviews

Automatically exported from code.google.com/p/elements-of-programming-interviews
Other
0 stars 0 forks source link

solution 4.1 error #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. shared_ptr<node_t<T>> 
2. new node_t<int>{i, nullptr}
3.

What is the expected output? What do you see instead?
the program cannot compile.

What version of the product are you using? On what operating system?
g++ 4.6.3, with -std=c++0x

Please provide any additional information below.
1. add space between the >>
2. add constructor for class node_t, or doesn't use {i, nullptr}

Original issue reported on code.google.com by aali...@gmail.com on 27 Mar 2013 at 4:22

GoogleCodeExporter commented 9 years ago
Hey,

The errors you encountered is because of C++11. I haven't tried to use GCC for 
a long time; instead, I use LLVM to compile those on my Mac. We had posted how 
to compile the program in the "Project Home" page. Let me digest the line for 
compiling method for you --- "From the command line, the command to compile C++ 
source is clang++ -Werror TargetFile.cpp -stdlib=libc++ -std=c++11 -O3". Please 
try this and report to us if there is any problem. Thanks!

Original comment by TsungHsi...@gmail.com on 27 Mar 2013 at 4:43

GoogleCodeExporter commented 9 years ago
Thank you. I use clang++ and it worked well.

Original comment by aali...@gmail.com on 27 Mar 2013 at 5:25

GoogleCodeExporter commented 9 years ago

Original comment by TsungHsi...@gmail.com on 27 Mar 2013 at 5:28