-2

Currently, I want to practice my C++ so I open a new folder to write some C++ codes. But weird thing happened. The editor shows me that one library bits/stdc++.h can not be resolved. Initially, I tried to delete and download MingW again at the D panel and reset the system path. But after that nothing changed.

I tracked the path of iostream (this one could be resolved) but found somehow my vscode point the library path at C->MicroSoft Visual Studio->2019....->iostream instead of D:/MingW/bin. I don't know how to solve this. So I tried running a cpp file at cmd that outputs "Hello World" to check my g++ setting, and it ran smoothly. I guess this is because my Vscode sets its library-finding path to the Microsoft VS 2019 but I can't find out where to change this.

Below will attach some screenshots as a detailed description, hope they can help you fix this question.
enter image description here

Note that I do not have the c_cpp_properties.json file, I also don't know why I don't have. enter image description here

Now I want to set my editor library-finding path to D:/MingW/bin. Or if my assumption is wrong, please point out the correct way.

joe Qi
  • 77
  • 5
  • You probably need to change your tasks.json and c_cpp_properties.json – drescherjm Sep 12 '22 at 13:06
  • 2
    `bits/stdc++.h` you should never include this file: [https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h](https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h) – drescherjm Sep 12 '22 at 13:06
  • 1
    Start by getting rid of [stdc++.h](https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h). Then we can talk. Code including a compiler specific header is not worth spending time on. And *please* don't post images. Post everything relevant as *text*. – Jesper Juhl Sep 12 '22 at 14:32

2 Answers2

-1

Change the header file to something wrong like "issotream". When it highlights it as an error, hover over it and select quick fix and click IncludePath. This will open a settings page, there you can add your bin path.

selu2k
  • 1
  • 2
-1

Open settings (UI if you're not comfortable with json), you can do it pressing

ctrl + shift + P

then select Preferences: Open Settings (UI) and search for include path. From the left drop down menu select Extensions -> C/C++ and navigate to Include Path. Here you can add new default paths.

Mind you that this will not tell the compiler anything about the libraries.

Hackjaku
  • 84
  • 1
  • 10