简体   繁体   中英

How to recover a C++ built-in header file?

I did something stupid toda yI was trying to make my own header file but accidentaly I overwrote the built-in file

#include <map>

Now I can't use map in my programs. It is showing undefined behavior.

Safest option: Reinstall

If you really don't want to reinstall you could just download the installation files without the setup (as it might be hard to get the files from the packed setup archive) and only replace the headers.

First make sure you know the exact version you have installed. The version of the compiler is important, not the IDE. For https://sourceforge.net/projects/orwelldevcpp/ you see 'TDM-GCC 4.9.2 32/64bit'. So looking under 'Files'->'Compilers'->'TDM-GCC' you find this page: https://sourceforge.net/projects/orwelldevcpp/files/Compilers/TDM-GCC/

Download the archive with your version (in this case the 4.9.2 ) in which you'll find an include folder under 'x86_64-w64-mingw32' which should be the one you need. Copy it over your compilers include folder. For more safety check folder structures, versions inside the headers etc. to make sure you really got the right version.

If in doubt at any point : Reinstall! Or you might do more harm than good ;)

Well I somehow figured out solution without re-installation.

What worked :

1) I typed header file name in new cpp file in dev c++.On hoovering it gave me path of the header file in my pc.

2) Using Quick access in windows 10 I reached desired location where map was actually present.

3) Opened map header file in notepad.It was not modified(don't know why).

4) How I ran random cpp file in dev-cpp which encountered error and open map to show it has error.I overwrite map header with what I have copied from notepad.

5) Ran like wind.Thanks everyone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM