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.
Note that I do not have the c_cpp_properties.json file, I also don’t know why I don’t have.
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.
2
Answers
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.
Open settings (UI if you’re not comfortable with json), you can do it pressing
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.