Mr Vahid
Mr Vahid

Reputation: 9

sstream: No such file or directory

What I have done so far:

Platform: Windows 7 (64 bit)

Installed GCC following this method

Downloaded Armadillo (armadillo-6.400.3.tar.gz) from link

Extracted Armadillo and put the source codes in the include folder.

creating main.cpp :

#include <armadillo>

int main()
{
    return 0;
}

compiling in windows cmd terminal:

g++ main.cpp -std=c++11

The compiler error result:

D:\c++\test>g++ main.cpp -std=c++11
g++: unrecognized option `-std=c++11'
In file included from main.cpp:2:
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2.91.
57\..\..\..\..\..\include\g++\armadillo:24: sstream: No such file or directory
In file included from main.cpp:2:
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2.91.
57\..\..\..\..\..\include\g++\armadillo:27: limits: No such file or directory
In file included from C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\..\lib\gcc-lib\i5
86-cygwin32\egcs-2.91.57\..\..\..\..\..\include\g++\armadillo:50,
                 from main.cpp:2:
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2.91.
57\..\..\..\..\..\include\g++\armadillo_bits/compiler_setup.hpp:173: #error "***
 Need a newer compiler ***"

Update

D:\c++\test>g++ --version
egcs-2.91.57

Upvotes: 0

Views: 5703

Answers (2)

Marged
Marged

Reputation: 10973

Judging by the file date and time and the output of the version command you are using an outdated compiler.

You should check if you need to stick to gcc, there are other compilers available on the Windows platform.

If you want to stick to gcc and especially cygwin (which contains many more unix like utilities) you should download the installer and choose the components needed. G++ would be one of them:

enter image description here

Upvotes: 1

Jan Hudec
Jan Hudec

Reputation: 76376

D:\c++\test>g++ --version
egcs-2.91.57

That is ancient. -std=c++11 is supported from gcc version 4.7 (somewhere earlier in the 4.x series the -std=c++0x option was introduced, but only the bits of C++11 that already existed were supported, since those were released before C++11 was finalized).

Upgrade to the latest MinGW or MinGW-w64 (a fork with some improvements and Win64 support).

You can also install via MSys2 or Cygwin. In the later case, mind the difference between gcc and mingw-gcc packages; the former builds binaries requiring cygwin1.dll, the later builds binaries using standard Microsoft runtime. MinGW and MSys2 should always use Microsoft runtime only.

Upvotes: 3

Related Questions