2607
2607

Reputation: 4125

How do I get crtdbg.h file?

I am using MinGW GCC + Eclipse on Windows, and I have run into this error:

C:\Program Files\ITG Derivatives LLC\api_clear-2.0.2.48\include/windows/csassert.h:12:20: fatal error crtdbg.h No such file or directory

What is the crtdbg.h file? How can I get it and solve this problem?

Upvotes: 20

Views: 62346

Answers (9)

dobrovv
dobrovv

Reputation: 33

I ran into this problem recently by trying to install LLVM/Visual Studio Code. It seems that the Windows SDK installation is required for the clang compiler.

To install the Windwos SDK open/download the Visual Studio Installer and select the "Windows 10 SDK" checkbox in the "Desktop in development with C++" toolbar.

Upvotes: 0

chzek chzek
chzek chzek

Reputation: 1

I was able to solve this by copy pasting all the files from: C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt

to the folder indicated in the error.

Upvotes: -1

Elvis Carter
Elvis Carter

Reputation: 1

I ran into this problem, I tried updating the SDK through Visual Studio as mentioned above to no avail. One thing I did was used an old PC to download the SDK, transferred the contents via USB. Took the File directory that Visual Studio was looking in, and copied everything over from the downloaded SDK in the USB to that file path/directory as mentioned in Visual Studio.

Hope this helps.

Upvotes: 0

Varun Sharma
Varun Sharma

Reputation: 2761

Just note that I got the same error in Visual Studio 2022 installed on Win 10 Version 21H2. Solution was to install latest Windows 10 SDK from here and then restart the computer.

Upvotes: 0

BOOM
BOOM

Reputation: 11

If you have the Windows SDK, and still have this error, go to project propreties -> VC++ -> Include Directories. then paste C:\Program Files (x86)\Windows Kits\10\Include(Version)\ucrt

Upvotes: 0

James-Jesse Drinkard
James-Jesse Drinkard

Reputation: 15723

I ran into this exact same issue, but with Visual Studio Community Edition 2019.

The solution was to download the Windows 10 SDK using the Visual Studio installer. Once I did that the next compile worked fine.

The header file "crtdbg.h" is part of the Windows 10 SDK kit. I believe you will find crtdbg.h located here C:\Program Files... or C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\crtdbg.h depending on your setup and version.

Upvotes: 28

Susobhan Das
Susobhan Das

Reputation: 3

I am from Go--g-- search here.

After installing Visual Studio 2019 preview(2022 preview), I have faced the same.

Opening Developer Command Prompt and after going to a particular folder,

cl test.cpp gave above error.

Resolve :

After installing Visual Studio 2022 preview or any other version, do reboot the system.

After rebooting, I could successfully, run the cl command, and compiled a test program without any of the above error.

Upvotes: 0

JHEK
JHEK

Reputation: 21

I ran into this exact same issue, but with Visual Studio Code. First start/restart VS Installer and install the Win10 SDK. Then restart your computer and the needed heasers are available.

Upvotes: 2

Bhavik Ambani
Bhavik Ambani

Reputation: 6657

<crtdbg.h> is a Microsoft Visual C++ specific header. You may be able to work around this problem using a stub similar to the following:

#ifdef _MSC_VER
#include <crtdbg.h>
#else
#define _ASSERT(expr) ((void)0)

#define _ASSERTE(expr) ((void)0)
#endif

Note that this will disable any asserts in the code you are compiling against, and still won't help you if the code you're compiling uses more advanced features inside crtdbg.h, such as memory leak detection. If these features are in use, you will need to compile the code with MSVC++ rather than MinGW.

Upvotes: 15

Related Questions