News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Compiling D 2.0

Started by Maxpm, March 31, 2011, 11:35:08 PM

Previous topic - Next topic

Maxpm

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


stahta01

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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Maxpm

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.

oBFusCATed

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...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Maxpm

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.

Maxpm

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.)

wangdong1226

#6
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

MortenMacFly

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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

wangdong1226


MortenMacFly

...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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Maxpm

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?

wangdong1226

#11
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.

wangdong1226

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.

MortenMacFly

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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

wangdong1226