fork download
  1. #include <iostream>
  2.  
  3. struct Matrix {
  4. static const int ColsAtCompileTime = 1;
  5. enum {RowsAtCompileTime = 42};
  6. };
  7.  
  8. void foo(const int& x) {
  9. std::cout << x << std::endl;
  10. }
  11.  
  12. int main() {
  13. foo(Matrix::RowsAtCompileTime); // works
  14. foo(Matrix::ColsAtCompileTime); // error!
  15. return 0;
  16. }
Compilation error #stdin compilation error #stdout 0s 3340KB
stdin
Standard input is empty
compilation info
/home/VWI5SC/ccjwkTOE.o: In function `main':
prog.cpp:(.text.startup+0x20): undefined reference to `Matrix::ColsAtCompileTime'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty