Reputation: 5261
I'm just trying out D and rdmd on mac OSX 10.7.5. I can get "hello world" to compile and run if I don't use rdmd, but I haven't been able to get rdmd to work. Here are the relevant files:
Users-MacBook:DProjects user$ ls -l /usr/bin/rdmd
-rwxr--r-- 1 user staff 27391 May 26 13:53 /usr/bin/rdmd
Users-MacBook:DProjects user$ ls -l ./hello2.d
-rwxr--r-- 1 user staff 78 May 26 14:13 ./hello2.d
Here is the program code: Users-MacBook:DProjects user$ cat hello2.d
#!/usr/bin/rdmd
import std.stdio;
void main() {
writeln("Hello, world!");
}
When I try to run it -- Users-MacBook:DProjects user$ ./hello2.d
./hello2.d: line 2: import: command not found
./hello2.d: line 3: syntax error near unexpected token `('
./hello2.d: line 3: `void main() {'
It appears that rdmd runs, but doesn't interpret the code correctly.
Please, can you tell em what I'm doing wrong?
Upvotes: 0
Views: 123
Reputation: 26
Doesn't look like rdmd is running. rdmd wouldn't call import
a command. That looks like an error from the shell.
Source and permissions for hello2.d look fine, but the file size is off. In UTF8/ASCII, with \n newlines, and without a trailing newline, that should be 75 bytes. 3 extra bytes suggests a BOM, which would interfere with the requirement that the shebang (#!
) has to be at the very beginning of the file. Try saving as UTF8 without BOM.
Upvotes: 1