Hi all. I recently downloaded and installed Bloodshed Dev-C++ and have begun going through C++ tutorials and whatnot. I'm very green on the whole C++ thing.

My current problem is that I want to use a .cpp file that someone else wrote that includes some so-called 'standard header' files, one of which is crtdbg.h.

I do not have crtdbg.h anywhere on my computer. It was not part of the Dev-C++ that I installed.

My question: is there a (legal) way I can get this file free so that I can use the previously mentioned cpp file? Is there some 'standard header' file package that I can download somewhere and put into the include path? Or is this some sort of propriatary standard header file that only comes with certian compilers? Any insight into this problem would be fantastic. Thanks!

Dani AI

Generated

Short answer for : <crtdbg.h> is not a standard ISO C/C++ header — it’s the Microsoft “CRT debug” header that comes with Visual C++ / the Windows SDK, so it isn’t bundled with Bloodshed Dev‑C++ (Dev‑C++ ships a MinGW/GCC toolchain). That explains why you don’t have the file in your Dev‑C++ include tree. (learn.microsoft.com)

Why the WinCE copy didn’t work (replying to ): the desktop crtdbg.h defines Microsoft‑specific debug helpers and macros such as _ASSERTE, _CRT_WARN, and the _RPT... family. A WinCE or third‑party header may be a different/limited implementation and so those names can be missing — which is exactly the “undeclared” errors you saw. Those debug routines are Microsoft CRT extensions. (learn.microsoft.com)

Practical options (pick one):

  • Quick hack (when the code only needs asserts/reporting): add a small compatibility header that maps the MS macros to standard assert() or stubs so MinGW can compile the file. Example shim:

    // crtdbg_shim.h
    #ifdef _MSC_VER
    #include <crtdbg.h>
    #else
    #include <assert.h>
    #include <stdio.h>
    #define _ASSERTE(x) assert(x)
    #define _ASSERT(x) assert(x)
    #define _CRT_WARN 1
    #define _RPT0(type, msg) (fprintf(stderr, "%s", msg), 0)
    #endif

    This compiles away the MS debug features; it’s fine for learning or simple code. (stackoverflow.com)

  • Proper fix (when the code uses debug‑CRT features like memory‑leak checks): build with Microsoft’s toolset — install the Windows SDK / Visual Studio (Community) so you get the real <crtdbg.h> (usually under C:\Program Files (x86)\Windows Kits\10\Include\<version>\ucrt\crtdbg.h) and compile with MSVC. Simply copying a single header into MinGW’s include folder often won’t provide the required runtime behavior. (learn.microsoft.com)

If staying with Dev‑C++, consider porting/removing MS‑specific debug calls or move to a more modern toolchain (MinGW‑w64/MSYS2 or Visual Studio) depending on whether you need the MS debug features.

Recommended Answers

All 3 Replies

This might help. This is for WinCE operating system and may, or may not, work on MS-Windows.

This might help. This is for WinCE operating system and may, or may not, work on MS-Windows.

Thanks, but I actually tried that already, and the .h file mentioned in that thread dosen't work. When I use it, I get these errors:
"'_ASSERTE undeclared"
"'_CRT_WARN' undeclared"
"'_RPTF0' undeclared"
In looking through the code for the crtdbg.h file mentioned above, there is nothing that mentions the above things.

The article on the msdn website references all of these functions to crtdbg.h, so I believe the one mentioned in the thread above is not the 'right' crtdbg.h.

Any other suggestions?

what compiler are you using? you will need eVC++ 3.0, eVC++ 4.0 or a smart device project with VC++ 2005 ( except Express edition). Those are the only compilers I know of that will target WinCE operating systems.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.