0

The code :

#include <bits/stdc++.h>

using namespace std;

int main()
{
    cout << "this file works";
    return 0;
}

Compiler output was ridiculously long. Some 114000 characters long. This is only a portion of it.

Compiler output on compilation :

C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:174:5: note:   no known conversion for argument 1 from 'std::basic_string_view<wchar_t>' to 'std::filesystem::__cxx11::path::string_type&&' {aka 'std::__cxx11::basic_string<wchar_t>&&'}
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:167:5: note: candidate: 'std::filesystem::__cxx11::path::path(std::filesystem::__cxx11::path&&)'
     path(path&& __p) noexcept
     ^~~~
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:167:5: note:   no known conversion for argument 1 from 'std::basic_string_view<wchar_t>' to 'std::filesystem::__cxx11::path&&'
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:165:5: note: candidate: 'std::filesystem::__cxx11::path::path(const std::filesystem::__cxx11::path&)'
     path(const path& __p) = default;
     ^~~~
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:165:5: note:   no known conversion for argument 1 from 'std::basic_string_view<wchar_t>' to 'const std::filesystem::__cxx11::path&'
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:163:5: note: candidate: 'std::filesystem::__cxx11::path::path()'
     path() noexcept { }
     ^~~~
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:163:5: note:   candidate expects 0 arguments, 1 provided
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.
  • What is your exception from the code? Simply printing "this file works" or something else? – Nagappa May 17 '20 at 04:24
  • 2
    `#include ` -- [Don't do this](https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h). Why did you use that header, when all the C++ books I've seen have `#include `? – PaulMcKenzie May 17 '20 at 04:28
  • In which environment are you compiling this. MSVC, XCode, or anything specific. Can you add those details. what is the compiler command line ? – Soundararajan May 17 '20 at 07:17

1 Answers1

1

So, what you are seeing is an error message, not an output. If the file bits/stdc++.h is not a file that you created,

then what you need to do is to replace

#include <bits/stdc++.h>

with

#include <iostream>

and that's gonna solve it for you.

Midoen
  • 46
  • 1
  • 4
  • Ok that works. But using bits/std used to work before. Why does it not work now? – SpiderMonkey69 May 17 '20 at 11:30
  • 1
    @SpiderMonkey69 One possible explanation is that your compiler and/or standard library changed something. Since `bits/stdc++.h` is an internal header (not designed for direct use in programs), it is allowed to change in program-breaking ways. A program using `#include ` is liable to break at any time with no warning. See [A: Why should I not `#include `?](https://stackoverflow.com/a/31816096) for a more detailed explanation. – JaMiT May 18 '20 at 01:23