Linker error with one particular function

Gary Willoughby dev at nomad.so
Wed Aug 14 06:21:47 PDT 2013


I have defined the following module:

/**
  * Module containing unit test helper functions for date time 
operations.
  */
module common.test.unit.datetime;

/**
  * Imports.
  */
import std.conv;
import std.datetime;

/**
  * Return a unix timestamp.
  *
  * Params:
  *     T = The return type of the unix timestamp.
  *     A = Variadic argument type for args parameter.
  *     args = Time arguments as specified by the DateTime struct.
  *
  * Reference:
  *     $(LINK http://dlang.org/phobos/std_datetime.html#.DateTime)
  */
T getUnixTime(T, A...)(A args)
{
	return to!T(SysTime(DateTime(args)).toUnixTime());
}

But when i import it and use the getUnixTime function i get the 
following linker error:

Undefined symbols for architecture x86_64:
   "_D6common4test4unit8datetime12__ModuleInfoZ", referenced from:
       _D5logic25generalstatisticprocessor12__ModuleInfoZ in main.o
       _D5logic14eventprocessor12__ModuleInfoZ in main.o
       _D5logic24devicestatisticprocessor12__ModuleInfoZ in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

Any idea why this is? If i comment out the getUnixTime function 
and put in other code it seems to import and work ok. Is it 
anything to do with the way i've written the function?


More information about the Digitalmars-d-learn mailing list