dcmtk 3.6.0 error C1083: Cannot open include file: 'iostream.h' 解决办法
2011年1月6日发布的dcmtk 3.6.0版本在编译完毕后, 用自己工程调用dcmdata.lib的过程中发现一个这样的错误: "error C1083: Cannot open include file:?'iostream.h'" 它指向到了一个USE_STD_CXX_INCLUDES的宏定义.
后来在比对它的新版本app的源码时才发现自从某个版本之后为了让旧的iostream.h等能与新的iostream?
STL一起用(之前版本默认是优先STL),在cmake building之后, USE_STD_CXX_INCLUDES的宏定义生成在了building 目录下的"\include\dcmtk\config\osconfig.h"里. (以前在3.5.4它的宏定义在"cfwin32.h"里,?从source目录里拷贝"osconfig.h"和"cfwin32.h"即可完成此宏的定义)这个请大家注意下.
?
所以这个问题的解决方法是:
将cmake?building 目录下的"\include\dcmtk\config\osconfig.h"拷贝到自己工程的include下面 (覆盖之前从source里拷贝过来的的osconfig.h.)(building前是1KB, building后是27KB左右)
?
其中在新的iostream.h中有说明
/* DCMTK by default does not anymore pollute the default namespace by?
?* importing namespace std. Earlier releases did this to simplify compatibility?
?* with older compilers where STL classes were not consistently defined?
?* in namespace std. We now have configure macros which should care for this.?
?* If user code still relies on namespace std to be included, compile with?
?* macro USING_STD_NAMESPACE defined.?
?*/
?
然后在Install说明文件中也有说明:
http://support.dcmtk.org/docs/file_install.html
?
? ?Visual C++ contains two different implementations of I/O streams which?
? ?should never be mixed within one application because this may cause?
? ?application errors that are hard to find. ?The old, now deprecated?
? ?implementation uses the traditional cfront header files <iostream.h> etc.?
? ?The new implementation uses <iostream> etc. as defined in ANSI/ISO C++.?
? ?DCMTK can be configured to use either of the two interfaces. ?This behaviour?
? ?can be changed in "include/dcmtk/config/osconfig.h" in the build directory?
? ?where the symbol USE_STD_CXX_INCLUDES is declared.
?
?