www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Strange problem with structure

reply Zarathustra <adam.chrapkowski gmail.com> writes:
I have got following part of code:
[code_code_code_code_code_code_code]
module basis;
import std.stdio;
import std.math;
import std.string; 
import std.process;

struct SCoordinate{
  int max;
  int min;
}

[code_code_code_code_code_code_code]
and following errors:
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
source\hiddenLine.obj(hiddenLine) 
 Error 42: Symbol Undefined _D5basis11SCoordinate3maxMFZl
source\hiddenLine.obj(hiddenLine) 
 Error 42: Symbol Undefined _D5basis11SCoordinate3minMFZl

It looks like linker treats min and max like external symbols, but why?
Jul 21 2008
next sibling parent "Koroskin Denis" <2korden gmail.com> writes:
On Mon, 21 Jul 2008 18:30:13 +0400, Zarathustra  
<adam.chrapkowski gmail.com> wrote:

 I have got following part of code:
 [code_code_code_code_code_code_code]
 module basis;
 import std.stdio;
 import std.math;
 import std.string;
 import std.process;

 struct SCoordinate{
   int max;
   int min;
 }

 [code_code_code_code_code_code_code]
 and following errors:
 OPTLINK (R) for Win32  Release 8.00.1
 Copyright (C) Digital Mars 1989-2004  All rights reserved.
 source\hiddenLine.obj(hiddenLine)
  Error 42: Symbol Undefined _D5basis11SCoordinate3maxMFZl
 source\hiddenLine.obj(hiddenLine)
  Error 42: Symbol Undefined _D5basis11SCoordinate3minMFZl

 It looks like linker treats min and max like external symbols, but why?
Looks like compiler is looking for these functions: long basis.SCoordinate.min() long basis.SCoordinate.max() but can't find their implementation. What code in module "hiddenLine" uses min/max and how? What version of DMD do you use? Could you post the code that makes this happen so that we could reproduce it?
Jul 21 2008
prev sibling parent Zarathustra <adam.chrapkowski gmail.com> writes:
Koroskin Denis Wrote:

 On Mon, 21 Jul 2008 18:30:13 +0400, Zarathustra  
 <adam.chrapkowski gmail.com> wrote:
 
 I have got following part of code:
 [code_code_code_code_code_code_code]
 module basis;
 import std.stdio;
 import std.math;
 import std.string;
 import std.process;

 struct SCoordinate{
   int max;
   int min;
 }

 [code_code_code_code_code_code_code]
 and following errors:
 OPTLINK (R) for Win32  Release 8.00.1
 Copyright (C) Digital Mars 1989-2004  All rights reserved.
 source\hiddenLine.obj(hiddenLine)
  Error 42: Symbol Undefined _D5basis11SCoordinate3maxMFZl
 source\hiddenLine.obj(hiddenLine)
  Error 42: Symbol Undefined _D5basis11SCoordinate3minMFZl

 It looks like linker treats min and max like external symbols, but why?
Looks like compiler is looking for these functions: long basis.SCoordinate.min() long basis.SCoordinate.max() but can't find their implementation. What code in module "hiddenLine" uses min/max and how? What version of DMD do you use? Could you post the code that makes this happen so that we could reproduce it?
All code in this twice modules have thousands of lines. Problem call (hiddenLine module) is following: l_edge2d.boundingRectangle.x.max // getter x is property of class: public SCoordinate x(SCoordinate o_x){ return this.m_x = o_x; } public SCoordinate x(){ return this.m_x; }
Jul 21 2008