| |
 | Posted by David T. Oxygen in reply to Steven Schveighoffer | Permalink Reply |
|
David T. Oxygen 
| On Wednesday, 8 October 2025 at 02:00:59 UTC, Steven Schveighoffer wrote:
> > > > Who knows why? I'm waiting for your answer.
Which D compiler, and version?
I used DMD 2.110.1 when compiling. Now I know it should be able to compile C files.
2.110.1 does not exist. Where did you get this compiler from? Make sure you only install official compilers.
https://dlang.org/changelog/index.html
When I use 2.111.0, it does work for me:
steves@homebuild:~$ dmd --version
DMD64 D Compiler v2.111.0
Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved written by Walter Bright
steves@homebuild:~$ cat hello.c
#include<stdio.h>
int main(){
printf("Hello World!\n");
return 0;
}
steves@homebuild:~$ dmd hello.c
steves@homebuild:~$ echo $?
0
steves@homebuild:~$ ./hello
Hello World!
steves@homebuild:~$
-Steve
--
Thank you for your help,but I still haven't solved my problem.
I reinstalled DMD 2.111.0 today,it's the newest relaese version. However,the compiler still keep silent when compiling dmd hello.c ...(If it can't compile,at last it should complain,all right? But it did nothing...)
But if I speak dmd --version it will tell me:
DMD64 D Compiler v2.111.0 Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved written by Walter Bright
And it can compile a normal D file which doesn't import a C file. If the D file imports a C file,the compiler will still keep silent...
Oh no that's too bad. I wonder if there may be anything wrong with my computer...
|