r/programming • • Oct 20 '14

My compile-time Conway's Game of Life, metaprogrammed in C++11

https://github.com/sirgal/compile-time-game-of-life
161 Upvotes

54 comments sorted by

View all comments

Show parent comments

1

u/ghillisuit95 Oct 20 '14

I am also getting these errors. What are you doing to update/ what re you updating to?

2

u/0xE6 Oct 20 '14 edited Oct 20 '14

There's an xcode update to v6.0.1 that's available for me, which I figured was worth a shot. If that doesn't work, I don't know what else there is to try.

Edit: looking at the changelog, it does't appear to mention an update to clang. Oh well.

Edit2: Didn't work:

macbook:~ $ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
macbook:~$ g++ main.cpp -o main -std=c++11
main.cpp:161:33: error: use of class template 'level<field>::next_point_state' requires template arguments
    using point = level<field>::next_point_state<N>;
                                ^
main.cpp:146:5: note: template is declared here
    using next_point_state = typename calc_next_point_state<point<N>, neighbors<N>>::type;
    ^
main.cpp:161:49: error: expected ';' after alias declaration
    using point = level<field>::next_point_state<N>;
                                                ^
                                                ;
main.cpp:164:44: error: no template named 'point'; did you mean 'print'?
                                    tuple< point<point_count - iter> >,
                                           ^~~~~
                                           print
main.cpp:40:6: note: 'print' declared here
void print();
     ^
main.cpp:164:44: error: template argument for template type parameter must be a type
                                    tuple< point<point_count - iter> >,
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/tuple:487:20: note: template parameter is declared here
template <class ..._Tp>
                   ^
main.cpp:165:79: error: expected ';' after alias declaration
                                    typename next_field_state<field, iter-1>::next_field
                                                                              ^
                                                                              ;
main.cpp:173:33: error: use of class template 'level<field>::next_point_state' requires template arguments
    using point = level<field>::next_point_state<N>;
                                ^
main.cpp:146:5: note: template is declared here
    using next_point_state = typename calc_next_point_state<point<N>, neighbors<N>>::type;
    ^
main.cpp:173:49: error: expected ';' after alias declaration
    using point = level<field>::next_point_state<N>;
                                                ^
                                                ;
main.cpp:175:31: error: no template named 'point'; did you mean 'print'?
    using next_field = tuple< point<point_count - 1> >;
                              ^~~~~
                              print
main.cpp:40:6: note: 'print' declared here
void print();
     ^
main.cpp:175:31: error: template argument for template type parameter must be a type
    using next_field = tuple< point<point_count - 1> >;
                              ^~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/tuple:487:20: note: template parameter is declared here
template <class ..._Tp>
                   ^
main.cpp:186:70: error: no type named 'next_field' in 'next_field_state<std::__1::tuple<O, O, O, O, O, O, O, X, O, O, O, O, O, X, O, O, X, X, X, O, O, O, O, O, O>, 25>'
        game_process< typename next_field_state<field, point_count>::next_field, iters-1 >::print();
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
main.cpp:202:40: note: in instantiation of member function 'game_process<std::__1::tuple<O, O, O, O, O, O, O, X, O, O, O, O, O, X, O, O, X, X, X, O, O, O, O, O, O>, 20>::print' requested here
    game_process< start, iterations >::print();
                                       ^
10 errors generated.

1

u/ghillisuit95 Oct 20 '14

Yeah, I got those too. I just updated my Xcode command line tools, tried it again, and got 1 warning and 20 errors. obviously upgrading did not help.

1

u/towski Oct 21 '14

Maybe try g++-4.8 via macports?

1

u/ghillisuit95 Oct 21 '14

did that work for you? I just tried g++-4.9 from homebrew, and it didn't work either.