c++ - Error compiling source which includes <new>
- Edward Diener (9/9) Aug 23 2010 The source file TestFile.cpp:
- Walter Bright (2/16) Aug 23 2010 It works when I try it.
- Edward Diener (12/29) Aug 23 2010 Here is my sc.ini:
- Walter Bright (3/5) Aug 24 2010 Sorry, I cannot reproduce it. BTW, you say installation disk. DMC has fo...
- Edward Diener (16/21) Aug 24 2010 When I bought dmc from you I used an installation disk you sent me.
- Walter Bright (4/29) Aug 24 2010 It's still a mystery, as that macro remains defined in my copy and the c...
- Edward Diener (53/83) Aug 24 2010 With _STLP_VENDOR_GLOBAL_STD defined, when I use the precompiler on
- Walter Bright (2/5) Aug 25 2010 Did you receive the new copy of dmc?
- Edward Diener (4/9) Aug 25 2010 No. How should I received it ?
- Walter Bright (4/15) Aug 26 2010 I sent download instructions via email. Apparently, the address I sent i...
- xharbour_deletethis telkom.net.id (Andi Jahja) (5/14) Aug 23 2010 What about if you add -cpp to the switches?
- Edward Diener (2/21) Aug 24 2010 Same error.
The source file TestFile.cpp: #include <new> The command line: dmc -c -Ar -Ae -Aa TestFile.cpp The result: class bad_alloc : public _STLP_EXCEPTION_BASE { ^ C:\Utilities\dm\bin\..\stlport\stlport\new(74) : Error: identifier expected --- errorlevel 1
Aug 23 2010
Edward Diener wrote:The source file TestFile.cpp: #include <new> The command line: dmc -c -Ar -Ae -Aa TestFile.cpp The result: class bad_alloc : public _STLP_EXCEPTION_BASE { ^ C:\Utilities\dm\bin\..\stlport\stlport\new(74) : Error: identifier expected --- errorlevel 1It works when I try it.
Aug 23 2010
On 8/23/2010 4:24 PM, Walter Bright wrote:Edward Diener wrote:Here is my sc.ini: [Version] version=8.52 [Environment] PATH=%PATH%;"% P%\..\bin" BIN="% P%\..\bin" INCLUDE="% P%\..\stlport\stlport";"% P%\..\include";"% P%\..\mfc\include";%INCLUDE% LIB="% P%\..\lib";"% P%\..\mfc\lib";%LIB% HELP="% P%\..\help" Would you please try it with that ? I have never changed anything in the stlport that comes with the installation disk.The source file TestFile.cpp: #include <new> The command line: dmc -c -Ar -Ae -Aa TestFile.cpp The result: class bad_alloc : public _STLP_EXCEPTION_BASE { ^ C:\Utilities\dm\bin\..\stlport\stlport\new(74) : Error: identifier expected --- errorlevel 1It works when I try it.
Aug 23 2010
Edward Diener wrote:Would you please try it with that ? I have never changed anything in the stlport that comes with the installation disk.Sorry, I cannot reproduce it. BTW, you say installation disk. DMC has for some time only come as a download. Perhaps you are using something old?
Aug 24 2010
On 8/24/2010 2:29 PM, Walter Bright wrote:Edward Diener wrote:When I bought dmc from you I used an installation disk you sent me. Subsequently I have used the downloads listed under "Updates for Digital Mars Development Systems" at http://www.digitalmars.com/download/freecompiler.html to upgrade the system. Was I supposed to do otherwise ? The problem I finally found was that the dmc configuration file, stlport/stlport/config/stl_dm.h, for the stlport 4.5.3 which originally comes with your compiler is wrong. The configuration defines a macro called _STLP_VENDOR_GLOBAL_STD which says that the "compiler-supplied standard library resides in global namespace, not std::". There may be other stlport configuration options there which are wrong but I think you have some responsibility in fixing that configuration file for end-users as you make changes to your compiler. Did I miss that somewhere ? Once I undefined that macro in the configuration file I was able to compile successfully.Would you please try it with that ? I have never changed anything in the stlport that comes with the installation disk.Sorry, I cannot reproduce it. BTW, you say installation disk. DMC has for some time only come as a download. Perhaps you are using something old?
Aug 24 2010
Edward Diener wrote:On 8/24/2010 2:29 PM, Walter Bright wrote:No, but perhaps there was a mistake somewhere in applying the patches.Edward Diener wrote:When I bought dmc from you I used an installation disk you sent me. Subsequently I have used the downloads listed under "Updates for Digital Mars Development Systems" at http://www.digitalmars.com/download/freecompiler.html to upgrade the system. Was I supposed to do otherwise ?Would you please try it with that ? I have never changed anything in the stlport that comes with the installation disk.Sorry, I cannot reproduce it. BTW, you say installation disk. DMC has for some time only come as a download. Perhaps you are using something old?The problem I finally found was that the dmc configuration file, stlport/stlport/config/stl_dm.h, for the stlport 4.5.3 which originally comes with your compiler is wrong. The configuration defines a macro called _STLP_VENDOR_GLOBAL_STD which says that the "compiler-supplied standard library resides in global namespace, not std::". There may be other stlport configuration options there which are wrong but I think you have some responsibility in fixing that configuration file for end-users as you make changes to your compiler. Did I miss that somewhere ? Once I undefined that macro in the configuration file I was able to compile successfully.It's still a mystery, as that macro remains defined in my copy and the compiles work.
Aug 24 2010
On 8/24/2010 7:02 PM, Walter Bright wrote:Edward Diener wrote:With _STLP_VENDOR_GLOBAL_STD defined, when I use the precompiler on source that only has #include <new>, I eventually see in the precompiled output: #line 64 "C:\Utilities\dm\bin\..\stlport\stlport\new" namespace std { class nothrow_t {}; extern const nothrow_t nothrow; #line 74 class bad_alloc : public ::exception { public: bad_alloc () { } bad_alloc(const bad_alloc&) { } bad_alloc& operator=(const bad_alloc&) {return *this;} ~bad_alloc () { } const char* what() const { return "bad alloc"; } }; } It is line 74 which gives the error. I believe it is because there is no ::exception class, since exception is actually std::exception, that the error message is occuring. Working my way back through why it says 'public ::exception' rather than 'std::exception" it is because _STLP_VENDOR_GLOBAL_STD is defined. The original says: "class bad_alloc : public _STLP_EXCEPTION_BASE {" where _STLP_EXCEPTION_BASE is: where _STLP_VENDOR_EXCEPT_STD: where _STLP_VENDOR_GLOBAL_EXCEPT_STD is not defined for dmc, so where _STLP_VENDOR_STD: where _STLP_VENDOR_GLOBAL_STD is defined ( see beginning of my reply ), so finally we have _STLP_EXCEPTION_BASE becoming "::exception". If _STLP_VENDOR_GLOBAL_STD is not defined then we have above: and "namespace __std_alias = std;" so we have _STLP_EXCEPTION_BASE becoming "std::exception". I hope this adequately explains why the error is occuring on my system and can lead you to discover why it is working on yours and what is different.On 8/24/2010 2:29 PM, Walter Bright wrote:No, but perhaps there was a mistake somewhere in applying the patches.Edward Diener wrote:When I bought dmc from you I used an installation disk you sent me. Subsequently I have used the downloads listed under "Updates for Digital Mars Development Systems" at http://www.digitalmars.com/download/freecompiler.html to upgrade the system. Was I supposed to do otherwise ?Would you please try it with that ? I have never changed anything in the stlport that comes with the installation disk.Sorry, I cannot reproduce it. BTW, you say installation disk. DMC has for some time only come as a download. Perhaps you are using something old?The problem I finally found was that the dmc configuration file, stlport/stlport/config/stl_dm.h, for the stlport 4.5.3 which originally comes with your compiler is wrong. The configuration defines a macro called _STLP_VENDOR_GLOBAL_STD which says that the "compiler-supplied standard library resides in global namespace, not std::". There may be other stlport configuration options there which are wrong but I think you have some responsibility in fixing that configuration file for end-users as you make changes to your compiler. Did I miss that somewhere ? Once I undefined that macro in the configuration file I was able to compile successfully.It's still a mystery, as that macro remains defined in my copy and the compiles work.
Aug 24 2010
Edward Diener wrote:I hope this adequately explains why the error is occuring on my system and can lead you to discover why it is working on yours and what is different.Did you receive the new copy of dmc?
Aug 25 2010
On 8/25/2010 1:54 PM, Walter Bright wrote:Edward Diener wrote:No. How should I received it ? Would you please explain what is different in my setup and yours so that I initially received the error but you did not ?I hope this adequately explains why the error is occuring on my system and can lead you to discover why it is working on yours and what is different.Did you receive the new copy of dmc?
Aug 25 2010
Edward Diener wrote:On 8/25/2010 1:54 PM, Walter Bright wrote:I sent download instructions via email. Apparently, the address I sent it to was wrong. Can you please email me your address?Edward Diener wrote:No. How should I received it ?I hope this adequately explains why the error is occuring on my system and can lead you to discover why it is working on yours and what is different.Did you receive the new copy of dmc?Would you please explain what is different in my setup and yours so that I initially received the error but you did not ?I think it'll be easier to just diff the directories, if the new one works.
Aug 26 2010
On Mon, 23 Aug 2010 12:37:27 -0400, Edward Diener <eddielee_no_spam_here tropicsoft.com> wrote:The source file TestFile.cpp: #include <new> The command line: dmc -c -Ar -Ae -Aa TestFile.cpp The result: class bad_alloc : public _STLP_EXCEPTION_BASE { ^ C:\Utilities\dm\bin\..\stlport\stlport\new(74) : Error: identifier expected --- errorlevel 1What about if you add -cpp to the switches? -- Andi
Aug 23 2010
On 8/24/2010 12:06 AM, Andi Jahja wrote:On Mon, 23 Aug 2010 12:37:27 -0400, Edward Diener <eddielee_no_spam_here tropicsoft.com> wrote:Same error.The source file TestFile.cpp: #include<new> The command line: dmc -c -Ar -Ae -Aa TestFile.cpp The result: class bad_alloc : public _STLP_EXCEPTION_BASE { ^ C:\Utilities\dm\bin\..\stlport\stlport\new(74) : Error: identifier expected --- errorlevel 1What about if you add -cpp to the switches? -- Andi
Aug 24 2010