Author Topic: Can't find crtdbg.h  (Read 39136 times)

Offline jmeuf

  • Multiple posting newcomer
  • *
  • Posts: 18
Can't find crtdbg.h
« on: January 29, 2007, 11:21:00 pm »
Hi,

I am trying to compile a source library which needs crtdbg.h
C::B can't find it and I checked that it is not included in the 'include' folder.

What can I do ? (...change your compiler. Nann, I was joking!!) :lol:

Thanks.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Can't find crtdbg.h
« Reply #1 on: January 29, 2007, 11:26:18 pm »
What can I do ? (...change your compiler. Nann, I was joking!!) :lol:
Why not? Your project obviously is based on the Microsoft compiler suite (there you can find the  "crtdbg.h"). But never-ever try to mix those header files (e.g. copy the MS one to the MinGW/GCC include folder...)
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline jmeuf

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Can't find crtdbg.h
« Reply #2 on: January 29, 2007, 11:29:19 pm »
That's what I feared ...

I would like to avoid as much as possible to go for Visual.
Is there any other compiler such DevC++ that can handle that ?

Offline troels

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Can't find crtdbg.h
« Reply #3 on: January 30, 2007, 12:01:44 am »
Try this:
#ifdef _MSC_VER
#include <crtdbg.h>
#else
#define _ASSERT(expr) ((void)0)

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

Offline jmeuf

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Can't find crtdbg.h
« Reply #4 on: March 01, 2007, 11:29:38 pm »
[solved] I finally reinstalled C::B aside 'VC++ Toolkit 2003' and 'Platform SDK' which provides the missing crtdbg.h file (in [pSDK_folder]\Include\crt). The process is described in:

http://wiki.codeblocks.org/index.php?title=Integrating_Microsoft_Visual_Toolkit_2003_with_Code::Blocks_IDE

What I am still missing now are precompiled headers which is available, as I understood, only for MinGW in rc2. I assume that it will be soon implemented on other compilers.

Thanks for your help.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Can't find crtdbg.h
« Reply #5 on: March 02, 2007, 02:19:54 am »
Is there any other compiler such DevC++ that can handle that ?

DevC++ is an IDE, not a compiler. ;)
Be a part of the solution, not a part of the problem.

Offline jmeuf

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Can't find crtdbg.h
« Reply #6 on: March 03, 2007, 09:11:13 pm »
Thanks for the precision !! (and so is CodeBlocks...)

By the way, I would like to keep the opportunity of this thread to ask a new question: I need to link the STL (Standard Template Library). Does anybody know where to find it?

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Can't find crtdbg.h
« Reply #7 on: March 03, 2007, 11:01:27 pm »
I need to link the STL (Standard Template Library). Does anybody know where to find it?
For any modern compiler, STL is part of the included Standard C++ Library. For GCC and MSVC, one need only include the appropriate header files for the classes one wishes to use; no additional libraries need to be linked in.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline saddam le pion

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: Can't find crtdbg.h
« Reply #8 on: March 03, 2007, 11:05:47 pm »
I am trying to compile a source library which needs crtdbg.h
C::B can't find it and I checked that it is not included in the 'include' folder.
http://dotnet.di.unipi.it/Content/sscli/docs/doxygen/pal/crtdbg_8h-source.html

Offline jmeuf

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Can't find crtdbg.h
« Reply #9 on: March 03, 2007, 11:52:59 pm »
Quote
For any modern compiler, STL is part of the included Standard C++ Library. For GCC and MSVC, one need only include the appropriate header files for the classes one wishes to use; no additional libraries need to be linked in.

I downloaded the headers of the stl v3.3 from the SGI web site: http://www.sgi.com/tech/stl/download.html and copied in my 'include' folder.

1. some files overwite: all 'non .h' files (algorithm, bitset, deque...)
Should I keep or overwrite?

2. I tried 'with' overwriting the above mentionned files and still get errors:

C:\Programme\VCToolkit2003\include\stl_alloc.h:305: fatal error C1001: INTERNAL COMPILER ERROR
:: === Build finished: 1 errors, 0 warnings ===

3. I tried 'without' overwriting, but then I don't resolve my missing external symbols
 :?

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Can't find crtdbg.h
« Reply #10 on: March 04, 2007, 12:34:01 am »
I downloaded the headers of the stl v3.3 from the SGI web site: http://www.sgi.com/tech/stl/download.html and copied in my 'include' folder.
Definitely not a good idea; as I said, the STL is a part of the Standard C++ Library included with every modern compiler. Overwriting headers that are included with your compiler is a sure recipe for disaster.

I must admit to never having used the Visual C++ 2003 Toolkit (which it appears you're using), but I do use Visual C++ 2005 (Standard) on a regular basis. I highly recommend you completely uninstall the VCTK (making sure whichever directory you installed it in is completely deleted) and then reinstall it (or, better yet, install MinGW/GCC instead). If you could then submit a sample of code that gives you errors along with the command line C::B uses in compiling it (make sure Settings->Compiler and debugger->Other settings->Compiler logging is set to Full command line), maybe we can figure out the problem.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Can't find crtdbg.h
« Reply #11 on: March 04, 2007, 05:48:27 am »
TDragon have already mentioned that STL is a part of every modern compiler. STL comes with VC, too. :)

To use it, provide the name of STL class with #include minus the .h

Try the following code and it should work perfectly in MSVC without adding any external STL package.

Code
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void)
{
string a, b;
a.assign("Hello");
b.assign("World");
cout << a + " " + b << endl;
// Another example with vector
vector<string> V;
V.push_back(a);
V.push_back(b);
for (int i = 0; i < (int) V.size(); ++i)
cout << V[i] << " ";
cin >> b;
return 0;
}

The same code would also compile perfectly in GCC. :)
« Last Edit: March 04, 2007, 06:42:22 am by Biplab »
Be a part of the solution, not a part of the problem.

Offline jmeuf

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Can't find crtdbg.h
« Reply #12 on: March 04, 2007, 10:08:52 pm »
Quote
I must admit to never having used the Visual C++ 2003 Toolkit (which it appears you're using), but I do use Visual C++ 2005 (Standard) on a regular basis. I highly recommend you completely uninstall the VCTK (making sure whichever directory you installed it in is completely deleted) and then reinstall it (or, better yet, install MinGW/GCC instead).

Ok. I understand that 'playing around' with the stl is not a good idea. I deduce that the VC++ Toolkit 2003 is 'too lite'. I have the opportunity to use the Visual Studio 2005 Express Edition, which is a free version of Visual Studio 2005. Do you think that it is a good idea to try it first?

Quote
If you could then submit a sample of code that gives you errors along with the command line C::B uses in compiling it (make sure Settings->Compiler and debugger->Other settings->Compiler logging is set to Full command line)

The code I'm trying to compile is not mine but provided as tutorial. It has been developped under MSVC compiler, I guess the same as yours. It will be difficult to split it as it is already composed of 5/6 .cpp sources files and associated headers + resource file.

Quote
The same code would also compile perfectly in GCC.

I'm used to work under gcc (MinGW). Unfortunately the snippets of code I want to reuse are only compilable under MSVC compiler... (remember the title of that thread  :D). I have no other choice than using an MS tool  :x. However you are right: I have compiled this code under MinGW without any problem  :lol:

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Can't find crtdbg.h
« Reply #13 on: March 04, 2007, 10:29:30 pm »
I deduce that the VC++ Toolkit 2003 is 'too lite'.
That depends on what your intended use is. With the toolkit by itself, I believe you're limited to standard C and C++ based console apps. But add the Microsoft Platform SDK and the sky's the limit.

Quote
I have the opportunity to use the Visual Studio 2005 Express Edition, which is a free version of Visual Studio 2005. Do you think that it is a good idea to try it first?
Yes, though not necessarily through Code::Blocks. Visual Studio is a competitor with C::B, on a usability basis if not a monetary one, so check out the competition and decide what fits your needs. I use both C::B and Visual Studio regularly, professionally and as a hobby, because each is better at certain things than the other.

Quote
The code I'm trying to compile is not mine but provided as tutorial. It has been developped under MSVC compiler, I guess the same as yours.
...
Unfortunately the snippets of code I want to reuse are only compilable under MSVC compiler...
If this code is intended only to be learned from, I would strongly recommend you drop it (if possible) and find a tutorial that is compiler-agnostic. Learning to write code that only works on one compiler (and is therefore not standards compliant) will only hurt you in the long run. If you truly have no alternative to using this code, then you'll still need to provide further details before you can be helped.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline jmeuf

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Can't find crtdbg.h
« Reply #14 on: March 04, 2007, 11:07:14 pm »
Quote
But add the Microsoft Platform SDK and the sky's the limit.

My environment includes:
  - C:B nightly
  - MinGW 345
  - VC++ Toolkit 2003
  - Platform SDK
... but I still don't see the sky !! Do you mean that the behold library is in pSDK rather than VCT2003?
I have all installed the full set following this wiki:

http://wiki.codeblocks.org/index.php?title=Integrating_Microsoft_Visual_Toolkit_2003_with_Code::Blocks_IDE

Quote
If this code is intended only to be learned from, I would strongly recommend you drop it (if possible) and find a tutorial that is compiler-agnostic.

In fact, behind this tuto lies a huge library that I have started to use to develop a complete window app. I am very happy with it and would really continue to use it. For more details, you can have a look here:

http://www.relisoft.com/rswl.html

Then, you will get the full picture of my situation !