0

I just installed Code::Blocks (version 20.03) on my computer (Windows) , with Mingw.

I created a new project ==> Console application ==> with C++ ==> Compiler GNU GCC Compiler

In my main.cpp I have a simple program :

 #include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

When I try to compile and run it , I have this error : c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\cwchar:44:10: fatal error: wchar.h: No such file or directory

I don't understand it because I have installed Code Blocks with Mingw.

Please can you help me ? How can I resolve this issue ?

Thank you in advance. I stay available if you need more information.

Raj
  • 197
  • 1
  • 2
  • 11
  • 1
    Minor side note: if you're just starting with C++, consider avoiding falling into the habit of using `using namespace std`. Sooner or later, it'll bite you. See [Why is “using namespace std;” considered bad practice?](https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice) – Brian61354270 Aug 18 '21 at 15:31
  • Are you sure you're compiling as C++ and not C? Also MinGW that comes with Code::Blocks is old. I recommend using the MinGW-w64 instead. A standalone download and instructions for Code::Blocks can be found on https://winlibs.com/. – Brecht Sanders Aug 18 '21 at 15:35

1 Answers1

0

I resolved the issue by removing C:\MinGW folder

then I modified the path to MinGW in Settings ==> Compiler ==> Global Compiler Settings ==> Toolchain executables ==> Compiler's installation directory

Then I put the MinGW of Code::Blocks

C:\CodeBlocks installation directory\CodeBlocks\MinGW

Then it worked

Maybe it can help others

Raj
  • 197
  • 1
  • 2
  • 11