April 11, 2006 STLport vs C | ||||
---|---|---|---|---|
| ||||
I found a strange compatibility problem between STLport and Standard C. In order to use STLport, I must modify sc.ini to add "%@P%\..\stlport\stlport" before "%@P%\..\include". However, with this change, the "-A" option of dmc no longer works (it is required to, say, compile GC test programs without modifications). The error reported is: # define __DFL_TMPL_PARAM( classname, defval ) class classname = defval ^ C:\dm\bin\..\stlport\stlport\stl/_config.h(370) : Preprocessor error: '_STLP_DEFAULT_TYPE_PARAM' is already defined leak_test.c(22) : Error: need at least one external def --- errorlevel 1 Any decent fix for that? (I guess header files like stdio.h under dm/stlport/stlport should have some #ifdef __cplusplus guides.) Best regards, Yongwei |
April 12, 2006 Re: STLport vs C | ||||
---|---|---|---|---|
| ||||
Posted in reply to Wu Yongwei | In article <e1fnt5$1nvt$1@digitaldaemon.com>, Wu Yongwei says... > >I found a strange compatibility problem between STLport and Standard C. In order to use STLport, I must modify sc.ini to add "%@P%\..\stlport\stlport" before "%@P%\..\include". However, with this change, the "-A" option of dmc no longer works (it is required to, say, compile GC test programs without modifications). The error reported is: > ># define __DFL_TMPL_PARAM( classname, defval ) class classname = defval >^ >C:\dm\bin\..\stlport\stlport\stl/_config.h(370) : Preprocessor error: >'_STLP_DEFAULT_TYPE_PARAM' is already defined >leak_test.c(22) : Error: need at least one external def >--- errorlevel 1 > >Any decent fix for that? (I guess header files like stdio.h under dm/stlport/stlport should have some #ifdef __cplusplus guides.) My current work-around: 1) Remove the stlport part from sc.ini; 2) Create a dmcpp.bat, containing something like "dmc -ID:\dm\stlport\stlport -cpp %*"; 3) Use dmcpp to build (Standard) C++ programs. It is inconvenient, may need coordination with other developers, and has the side-effect that any "-I" option specified on the command line goes AFTER the stlport path. The better way should be that dmc can define C++-specific include directories independent of the C include directories (in sc.ini). GCC behaves this way, both by default setting and by environment variables (CPATH for C/C++, C_INCLUDE_PATH for C, and CPLUS_INCLUDE_PATH for C++). Best regards, Yongwei |
Copyright © 1999-2021 by the D Language Foundation