Jump to page: 1 2
Thread overview
Error compiling source which includes <new>
Aug 23, 2010
Edward Diener
Aug 23, 2010
Walter Bright
Aug 23, 2010
Edward Diener
Aug 24, 2010
Walter Bright
Aug 24, 2010
Edward Diener
Aug 24, 2010
Walter Bright
Aug 24, 2010
Edward Diener
Aug 25, 2010
Walter Bright
Aug 25, 2010
Edward Diener
Aug 26, 2010
Walter Bright
Aug 24, 2010
Andi Jahja
Aug 24, 2010
Edward Diener
August 23, 2010
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
August 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 1

It works when I try it.
August 23, 2010
On 8/23/2010 4:24 PM, Walter Bright wrote:
> 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 1
>
> It works when I try it.

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.
August 24, 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 1

What about if you add -cpp to the switches?
--
Andi
August 24, 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:
>
>> 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
>
> What about if you add -cpp to the switches?
> --
> Andi

Same error.
August 24, 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?
August 24, 2010
On 8/24/2010 2:29 PM, Walter Bright wrote:
> 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?

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.
August 24, 2010
Edward Diener wrote:
> On 8/24/2010 2:29 PM, Walter Bright wrote:
>> 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?
> 
> 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 ?

No, but perhaps there was a mistake somewhere in applying the patches.


> 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.
August 24, 2010
On 8/24/2010 7:02 PM, Walter Bright wrote:
> Edward Diener wrote:
>> On 8/24/2010 2:29 PM, Walter Bright wrote:
>>> 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?
>>
>> 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 ?
>
> No, but perhaps there was a mistake somewhere in applying the patches.
>
>
>> 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.

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:

"#  define _STLP_EXCEPTION_BASE _STLP_VENDOR_EXCEPT_STD::exception"

where _STLP_VENDOR_EXCEPT_STD:

"#  ifdef _STLP_VENDOR_GLOBAL_EXCEPT_STD
#   define _STLP_VENDOR_EXCEPT_STD
#  else
#   define _STLP_VENDOR_EXCEPT_STD _STLP_VENDOR_STD
#  endif"

where _STLP_VENDOR_GLOBAL_EXCEPT_STD is not defined for dmc, so where _STLP_VENDOR_STD:

"#  ifdef _STLP_VENDOR_GLOBAL_STD
#   define _STLP_VENDOR_STD
#   define _STLP_USING_VENDOR_STD
#  else
#   define _STLP_VENDOR_STD __std_alias
#   define _STLP_USING_VENDOR_STD _STLP_USING_NAMESPACE(_STLP_VENDOR_STD)
// #   define _STLP_USING_VENDOR_STD
#  endif"

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:

"#   define _STLP_VENDOR_STD __std_alias"

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.
August 25, 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?
« First   ‹ Prev
1 2