1

Compiling the program below on windows with g++ file.cpp -std=c++11

#include<bits/stdc++.h>
using namespace std;

int main() {
    int x = 0;
    cout << x;
    return 0;
}

gives an error that you can see on link below (unable to post error here due to stackoverflow's too much code in comparison to text constraint, sorry for posting it this way!)

https://drive.google.com/file/d/0B4w9GgJk2CmjdGg0TjluWElNRTQ/view

In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\postypes.h:40:0,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\istream:38,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\sstream:38,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\complex:45,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ccomplex:38,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\mingw32\bits\stdc++.h:52,
                 from template.cpp:1:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:177:11: error: '::wcscat' has not been declared
   using ::wcscat;
           ^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:178:11: error: '::wcscmp' has not been declared
   using ::wcscmp;
...

Any pointers where this is going wrong? (Using gcc 5.3)

melpomene
  • 79,257
  • 6
  • 70
  • 127
Udit Bhutani
  • 117
  • 1
  • 6
  • 1
    Including that header is a bad idea in general: http://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h?rq=1 – melpomene May 13 '17 at 08:18

1 Answers1

2

use std=gnu++11

g++ file.cpp -std=gnu++11
tso
  • 4,174
  • 2
  • 17
  • 30