Code::Blocks Forums

User forums => Help => Topic started by: Maxpm on March 31, 2011, 11:35:08 pm

Title: Compiling D 2.0
Post by: Maxpm on March 31, 2011, 11:35:08 pm
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:
Code
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
Title: Re: Compiling D 2.0
Post by: stahta01 on March 31, 2011, 11:59:03 pm
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.
Title: Re: Compiling D 2.0
Post by: Maxpm on April 01, 2011, 01:04:31 am
I downloaded the latest nightly build and enabled full compiler logging.

Code
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.
Title: Re: Compiling D 2.0
Post by: 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...
Title: Re: Compiling D 2.0
Post by: Maxpm on April 01, 2011, 02:43:43 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.
Title: Re: Compiling D 2.0
Post by: Maxpm on April 01, 2011, 02:58:45 am
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.)
Title: Re: Compiling D 2.0
Post by: wangdong1226 on April 02, 2011, 03:39:32 am
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)
Title: Re: Compiling D 2.0
Post by: MortenMacFly on April 02, 2011, 09:14:53 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.
Title: Re: Compiling D 2.0
Post by: wangdong1226 on April 02, 2011, 02:17:20 pm
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)
Title: Re: Compiling D 2.0
Post by: 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.
Title: Re: Compiling D 2.0
Post by: 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?
Title: Re: Compiling D 2.0
Post by: wangdong1226 on April 03, 2011, 09:28:22 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.
Title: Re: Compiling D 2.0
Post by: wangdong1226 on April 03, 2011, 09:32:20 am
...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.
Title: Re: Compiling D 2.0
Post by: MortenMacFly on April 03, 2011, 09:42:20 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.
Title: Re: Compiling D 2.0
Post by: wangdong1226 on April 04, 2011, 03:37:20 pm
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.
Title: Re: Compiling D 2.0
Post by: MortenMacFly on April 04, 2011, 03:59:37 pm
Instruction for DMD2 in CodeBlocks.
Thanks a lot! Your contribution is really appreciated. :P