使用 Code::Blocks 编译 D
我在 Code::Blocks 中编译 D 程序时遇到问题。我正在做的事情如下:
- 根据我的组织惯例,我已将 Digital Mars D2 编译器解压到
C:\Compilers\dmd2
。我还在C:\Compilers\dm
处安装了 Digital Mars C/C++ 编译器。 - 对于“全局编译器设置”窗口中的“工具链可执行文件”选项卡,我已将字段设置为...
- 编译器安装目录:
C:\Compilers\dmd2\windows
- C 编译器:
dmd.exe
- C++ 编译器:
dmd.exe
- 动态库链接器:
dmd.exe
- 静态库链接器:
lib.exe
- 调试器:
windbg.exe
- 资源编译器:
rcc.exe
(这是默认文件,不存在。我不知道要设置什么。) - 制作程序:
make.exe
- 编译器安装目录:
- 我有以下列为附加路径:
C:\Compilers\dmd2\windows\lib
C:\Compilers\dmd2\windows\bin
当我启动一个新的 D 项目时,我没有看到任何语法突出显示。尝试编译并运行简单的“hello world”程序会导致以下错误:
“Hello World in D - Debug”使用无效的编译器。可能编译器选项中的工具链路径设置不正确?!跳过... 无事可做。
我做错了什么?
I'm having trouble compiling D programs in Code::Blocks. Here's what I'm doing:
- In accordance with my organization conventions, I have unzipped the Digital Mars D2 compiler to
C:\Compilers\dmd2
. I also have the Digital Mars C/C++ compiler atC:\Compilers\dm
. - For the "Toolchain executables" tab in the "Global compiler settings" window, I have set the fields to...
- Compiler installation directory:
C:\Compilers\dmd2\windows
- C compiler:
dmd.exe
- C++ compiler:
dmd.exe
- Linker for dynamic libs:
dmd.exe
- Linker for static libs:
lib.exe
- Debugger:
windbg.exe
- Resource compiler:
rcc.exe
(This is the default file, which does not exist. I'm not sure what to set this to.) - Make program:
make.exe
- Compiler installation directory:
- I have the following listed as additional paths:
C:\Compilers\dmd2\windows\lib
C:\Compilers\dmd2\windows\bin
When I start a new D project, I do not see any syntax highlighting. Attempting to compile and run a simple "hello world" program results in the following error:
"Hello World in D - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...
Nothing to be done.
What am I doing incorrectly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不确定这是否确实导致了问题,但您的 C/C++ 编译器应该是 dmc,而不是 dmd(它是不同的下载包)。尝试解决这个问题,看看是否有帮助(尽管可能没有)。
I'm not sure if this is in fact causing the problem, but your C/C++ compiler should be
dmc
, notdmd
(it's a different download package). Try fixing that, and seeing if that helps (although it might not).编译器安装目录应为 *C:\Compilers\dmd2*
The Compiler installation directory should be *C:\Compilers\dmd2*
经过一番尝试后,我终于开始工作了。
我完全重新安装了 Code::Blocks 和 Digital Mars 的所有内容。
当我重新安装 Code::Blocks 时,我选择了 D 词法分析器(它为我提供了语法突出显示)。
在新的 D 编译器文件夹中,我删除了 Linux 和 OSX 的文件夹,并将文件从 Windows 文件夹移动到主文件夹中。
After playing around a bit I finally got it to work.
I did a complete reinstall of everything Code::Blocks and Digital Mars.
When I was reinstalling Code::Blocks, I opted-in to the D lexer (which gives me syntax highlighting).
In the new D compiler folder, I removed the folders for Linux and OSX and moved the files from the Windows folder into the main folder.