www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problem building DMD

reply Eric <eric makechip.com> writes:
I'm trying to build the master branch of DMD on redhat 7.
I get the following errors:

ddmd/root/newdelete.c:26:8: error: expected identifier or ‘(’ 
before string constant
  extern "C"
         ^
ddmd/root/newdelete.c:31:17: error: expected ‘=’, ‘,’, ‘;’,
‘asm’ 
or ‘__attribute__’ before ‘new’
  void * operator new(size_t m_size)
                  ^
ddmd/root/newdelete.c:36:15: error: expected ‘=’, ‘,’, ‘;’,
‘asm’ 
or ‘__attribute__’ before ‘delete’
  void operator delete(void *p)

Does anyone know what I am doing wrong?
Mar 11
parent reply ag0aep6g <anonymous example.com> writes:
On 03/11/2017 06:41 PM, Eric wrote:
 I'm trying to build the master branch of DMD on redhat 7.
 I get the following errors:

 ddmd/root/newdelete.c:26:8: error: expected identifier or ‘(’ before
 string constant
  extern "C"
         ^
 ddmd/root/newdelete.c:31:17: error: expected ‘=’, ‘,’, ‘;’,
‘asm’ or
 ‘__attribute__’ before ‘new’
  void * operator new(size_t m_size)
                  ^
 ddmd/root/newdelete.c:36:15: error: expected ‘=’, ‘,’, ‘;’,
‘asm’ or
 ‘__attribute__’ before ‘delete’
  void operator delete(void *p)

 Does anyone know what I am doing wrong?
Looks like a C compiler is used instead of a C++ compiler. Despite the extension, dmd's *.c files are C++ code.
Mar 11
next sibling parent Eric <eric makechip.com> writes:
On Saturday, 11 March 2017 at 17:54:55 UTC, ag0aep6g wrote:
 Looks like a C compiler is used instead of a C++ compiler. 
 Despite the extension, dmd's *.c files are C++ code.
Yes, that's what I thought - redhat has gcc, but not g++. There must be a needed compile option...
Mar 11
prev sibling parent Eric <eric makechip.com> writes:
On Saturday, 11 March 2017 at 17:54:55 UTC, ag0aep6g wrote:
 On 03/11/2017 06:41 PM, Eric wrote:
 I'm trying to build the master branch of DMD on redhat 7.
 I get the following errors:

 ddmd/root/newdelete.c:26:8: error: expected identifier or ‘(’ 
 before
 string constant
  extern "C"
         ^
 ddmd/root/newdelete.c:31:17: error: expected ‘=’, ‘,’, ‘;’, 
 ‘asm’ or
 ‘__attribute__’ before ‘new’
  void * operator new(size_t m_size)
                  ^
 ddmd/root/newdelete.c:36:15: error: expected ‘=’, ‘,’, ‘;’, 
 ‘asm’ or
 ‘__attribute__’ before ‘delete’
  void operator delete(void *p)

 Does anyone know what I am doing wrong?
Looks like a C compiler is used instead of a C++ compiler. Despite the extension, dmd's *.c files are C++ code.
Yes - I needed to install gcc-c++, not g++. That fixed everything.
Mar 11