1

I want to include matrix library to my project, but when i include matrix.h and matrix.hpp here are errors :

 initializer_list: No such file or directory
 error: tuple: No such file or directory
error: type_traits: No such file or directory

Lines

#include <initializer_list>
#include <algorithm>
#include <tuple>
#include <memory>
#include <iostream>
#include <string>
#include <type_traits>

truble it. Help,plz. I think here is some kind of problem with standards

gcc 4.8; Mac OS

user2897535
  • 83
  • 1
  • 2
  • 7

1 Answers1

4

Since you are using GCC-4.8 and your problem is that you don't have the C++11 features try to add -std=c++11 to your compilation line.

I saw that you are using CMake, then this post may help you (you can replace -std=c++0x by -std=c++11 or -std=gnu++11).

Example:

# It appends the -std=c++11 option to CMAKE_CXX_FLAGS
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # for gcc >= 4.7

# Or
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") # for gcc < 4.7
Community
  • 1
  • 1
Pierre Fourgeaud
  • 14,290
  • 1
  • 38
  • 62
  • I have 'code'SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -O2 -Wno-unused-value")'code' when i change it to 'code'SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS} -O2 -Wno-unused-value")'code' it answers 'code' unrecognized command line option "-std=c++11" 'code' – user2897535 Oct 21 '13 at 12:17
  • @user2897535: You may need `-std=c++0x` (rather than `c++11`) on older versions of GCC; but I would have thought that 4.8 would understand `c++11`. – Mike Seymour Oct 21 '13 at 12:25
  • it doesn't understand -std=c++0x too. I think i write it in a wrong way, but i dont know the right one. – user2897535 Oct 21 '13 at 12:27
  • @user2897535 and you have the same error? Are you sure you use gcc? I thought that CMake was using `clang` on MacOSX by default... [**This**](http://stackoverflow.com/a/11004675/1394283) may be useful. – Pierre Fourgeaud Oct 21 '13 at 12:35