I am new to C++ and I am debugging one problem where there is a allocate.h
file which is included by main.cpp
file. Now the allocate.h
file has first line like this : #include <memory.h>
. and when I try to compile main.cpp
I get an error message saying
Microsoft Visual Studio 11.0\ VC\ include\ typeinfo (153) : error
C2504 exception base class undefined
But when I change that first line to : #include <memory>
then main.cpp compiles fine. Thats when I started to search the web for difference between these two styles of including files and I haven't found any detailed explanation yet. If anybody can explain the difference between including a .h file and a memory standard header, that would be really helpful.
Is it because #include<memory>
is more thread safe ? or is it because its just the way in c++ to include files.
Also I am using cmake to include my project in the llvm's generated solution. When generating my .vcxproj
file it includes _HAS_EXCEPTIONS=0;
in the <PreprocessorDefinitions>
tag in it. If I use the earlier declaration #include<memory.h>
and remove _HAS_EXCEPTIONS=0;
from the <PreprocessorDefinitions>
tag then the project compiles fine. How is all this connected ? Can somebody help me connect the dots ?