It's relatively simple to set up Code::Blocks to compile D 1.0 programs, but I'm having a lot of trouble with D 2.0.
I went through all the paths in the compiler settings for the Digital Mars D compiler, changing the paths from "dmd" to "dmd2." However, when I try to compile a simple "Hello, world!" program I get an error message saying the object file could not be read. (It's not particularly helpful.)
Here's the full error:
Compiling: hello.d
object.d: Error: module object is in file 'object.d' which cannot be read
import path[0] = C:\Compilers\dmd2\src\phobos
import path[1] = C:\Compilers\dmd2\bin\..\..\src\phobos
import path[2] = C:\Compilers\dmd2\bin\..\..\src\druntime\import
Turn on Full Compiler Logging and hopefully the problem will be clear to an D programmer; not sure this site has that many D programmers on it.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
Note: You might try a nightly build if not already using one.
Tim S.
I downloaded the latest nightly build and enabled full compiler logging.
dmd.exe -g -debug -IC:\Compilers\dmd2\src\phobos -c hello.d -ofobj\Debug\hello.obj
object.d: Error: module object is in file 'object.d' which cannot be read
import path[0] = C:\Compilers\dmd2\src\phobos
import path[1] = C:\Compilers\dmd2\bin\..\..\src\phobos
import path[2] = C:\Compilers\dmd2\bin\..\..\src\druntime\import
This is, of course, after a full cleaning.
Something is broken in your compiler.
Try to compile from the command line and if it works it something in C::B, if it doesn't it is something with your setup...
Quote from: oBFusCATed on April 01, 2011, 01:13:12 AM
Something is broken in your compiler.
Try to compile from the command line and if it works it something in C::B, if it doesn't it is something with your setup...
Attempting to compile from the command line produces the exact same error.
Attempting to compile from the command line produces the exact same error.
(I apologize if this is a double-post; it seems my messages keep disappearing.)
Hi, Maxpm,
I would like to describe simple steps for DMD compiling in CodeBlocks.
For Windows:
http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Digital_Mars_D_Compiler_for_Windows (http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Digital_Mars_D_Compiler_for_Windows)
Quote from: wangdong1226 on April 02, 2011, 03:39:32 AM
2). Settings.
You should add correct DMD pathes into Codeblocks' "default.conf" configuration file.
Here is the section about 'dmd' settings in my "default.conf" file for your reference.
[...]
Please don't edit this file manually. You can setup these path's in the compiler setup just fine. If you alter the configuration file manually you can easily screw Code::Blocks settings completely.
For Linux (for example, Fedora)
http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Digital_Mars_D_Compiler_for_Linux (http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Digital_Mars_D_Compiler_for_Linux)
...could you add this to the WiKi and point to it from this page:
http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Misc._Custom_Compilers
...so that it doesn't get lost.
Thank you all for your help. I can now compile and run D programs without any problems. The syntax highlighting works as well, but code completion seems to be glitched. No matter which keyword I (partially) type, I get the message "The Parser is still parsing files." I'm assuming D code completion simply isn't supported yet in Code::Blocks, but is there a way to disable the feature just for D so I don't get this annoying message?
Quote from: Maxpm on April 03, 2011, 01:32:02 AM
Thank you all for your help. I can now compile and run D programs without any problems. The syntax highlighting works as well, but code completion seems to be glitched. No matter which keyword I (partially) type, I get the message "The Parser is still parsing files." I'm assuming D code completion simply isn't supported yet in Code::Blocks, but is there a way to disable the feature just for D so I don't get this annoying message?
Yes, I'm meeting the same problem (I mean "The Parser is still parsing files.", but it does nothing), I think, in future, when CodeBlocks team improved the Code Completion part of CodeBlocks, then things will be improved.
I've submitted several times asking for improving D Language support in CodeBlocks, but unfortunately there is no one in CodeBlocks team using D Language or familiar with this language, so I think now things won't take on a new look. (maybe someone will be kindly to modify the Code Completion, I don't know)
I studied the C Language, and I'm not familiar with the C++, so I can do nothing on providing patches to CodeBlocks issue. But I made a personal decision that I will start to learn C++, after that I'll try to submit the improving patches to CodeBlocks core team to improve the support of D Language.
(but it will takes a long time when I familiar with the C++ :D)
Best regards.
David.
Quote from: MortenMacFly on April 02, 2011, 11:17:36 PM
...could you add this to the WiKi and point to it from this page:
http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Misc._Custom_Compilers
...so that it doesn't get lost.
OK, I'll try to add the description to the WiKi so that more people will see that and it won't get lost.
Quote from: Maxpm on April 03, 2011, 01:32:02 AM
but is there a way to disable the feature just for D so I don't get this annoying message?
Sure, just disable the CC plugin. It's useless for you anyways.
Instruction for DMD2 in CodeBlocks.
DMD2 for Windows:
http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Digital_Mars_D_Compiler_for_Windows (http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Digital_Mars_D_Compiler_for_Windows)
DMD2 for Linux:
http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Digital_Mars_D_Compiler_for_Linux (http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Digital_Mars_D_Compiler_for_Linux)
Best regards.
David.
Quote from: wangdong1226 on April 04, 2011, 03:37:20 PM
Instruction for DMD2 in CodeBlocks.
Thanks a lot! Your contribution is really appreciated. :P