Windows 上的 D2 入门
我从 http://www.digitalmars 获取了“dmd D 2.0 编译器一键安装 Windows” .com/d/download.html,安装并尝试编译《The D 编程语言》中的 hello world 示例,即
import std.stdio;
void main() {
writeln("Hello, world!");
}
使用“dmd hello.d”,但遇到了:
hello.d(4): Error: undefined identifier writeln, did you mean function writefln?
hello.d(4): Error: function expected before (), not __error of type _error_
这本书是出自日期,或是否有什么东西安装不正确,或者...?
I grabbed the "dmd D 2.0 compiler 1-click install for Windows" from http://www.digitalmars.com/d/download.html, installed, and tried to compile the hello world example from "The D Programming Language", i.e.
import std.stdio;
void main() {
writeln("Hello, world!");
}
with "dmd hello.d", but was met with:
hello.d(4): Error: undefined identifier writeln, did you mean function writefln?
hello.d(4): Error: function expected before (), not __error of type _error_
Is the book out of date, or did something install incorrectly, or...?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
输入不带任何参数的“dmd”,然后查看您正在运行的版本。你好像用的是D1。
在您的环境中,安装程序可能将 dmd 的路径放在 dmd2 的路径之前。检查您的 PATH 变量。
Type 'dmd' without any arguments and see what version you're running. You seem to be using D1.
The installer probably placed the path to dmd before the path to dmd2 in your environment. Check your PATH variable.