我只是从http://www.digitalmars.com/d/download.html为Ubuntu 64位(dmd_2.055-0_amd64.deb)安装DMD编译器。但是当我尝试运行一个简单的hello.d
import std.stdio;
void main()
{
writeln("hello");
}
使用终端上的命令:$ dmd hello.d
显示以下错误:
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libphobos2.a(datetime_48b_1ec.o): In function `_D3std8datetime5Clock11currStdTimeFNdNeZl':
std/datetime.d:(.text._D3std8datetime5Clock11currStdTimeFNdNeZl+0x1d): undefined reference to `clock_gettime'
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libphobos2.a(time_c0_4d1.o): In function `_D4core4time12TickDuration12_staticCtor7OFNeZv':
src/core/time.d:(.text._D4core4time12TickDuration12_staticCtor7OFNeZv+0x1f): undefined reference to `clock_getres'
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libphobos2.a(time_c0_4d1.o): In function `_D4core4time12TickDuration14currSystemTickFNdNeZS4core4time12TickDuration':
src/core/time.d:(.text._D4core4time12TickDuration14currSystemTickFNdNeZS4core4time12TickDuration+0x1f): undefined reference to `clock_gettime'
collect2: ld devolvió el estado de salida 1
--- errorlevel 1
我不知道问题是什么,我无法在网上找到解决方案。
答案 0 :(得分:6)
这里讨论过:http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=146675
尝试在/etc/dmd.conf
行-L-lphobos2
之前修改-L-lrt
并移动DFLAGS
。