-1

I ran this C++ program (Code on gfg) on VSCode using the run button and it exits with code=1 and shows this message :

[Running] cd "c:\Users\pawar\OneDrive\Desktop\cp\" && g++ 5.cpp -o 5 && "c:\Users\pawar\OneDrive\Desktop\cp\"5
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cassert:44:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\stdc++.h:33,
                 from 5.cpp:44:
c:\mingw\include\assert.h:38:38: error: conflicting declaration of C function 'void _assert(const char*, const char*, long long int)'
 _CRTIMP void __cdecl __MINGW_NOTHROW _assert (const char*, const char*, int) __MINGW_ATTRIB_NORETURN;
                                      ^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cassert:44:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\stdc++.h:33,
                 from 5.cpp:6:
c:\mingw\include\assert.h:38:38: note: previous declaration 'void _assert(const char*, const char*, int)'
 _CRTIMP void __cdecl __MINGW_NOTHROW _assert (const char*, const char*, int) __MINGW_ATTRIB_NORETURN;
[Done] exited with code=1 in 3.051 seconds

The program ran successfully on Codeforces and Codechef ide, But did not run on Geeksforgeeks ide(SIGABRT error) and VSCode. Can someone help me how to fix this, so that it runs on VSCode, is it something to de with the compiler used, please guide?

MikeCAT
  • 73,922
  • 11
  • 45
  • 70

1 Answers1

0

#include<bits/stdc++.h>

This line was included twice, which caused the error.

  • Good it works. Now, you may be interested reading this: https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h – Damien Jan 29 '21 at 13:45