View mode: basic / threaded / horizontal-split · Log in · Help
June 24, 2008
CodeBlocks
I have managed to get CodeBlocks 8.02 work with dmd-2.012 under linux. It
wasn't obviouos (at least for me), so if someone is interested, I could
make a short howto.
June 25, 2008
Re: CodeBlocks
David Ferenczi wrote:
> I have managed to get CodeBlocks 8.02 work with dmd-2.012 under linux. It
> wasn't obviouos (at least for me), so if someone is interested, I could
> make a short howto.

Please do, and put it on http://wiki.codeblocks.org as well ?

If there are changes to Code::Blocks needed, please file a bug

--anders
June 25, 2008
Re: CodeBlocks
Here is the first draft. It would be nice if somebody would try it out, to
have some feedback.

1. Go to "Settings" -> "Compiler and debugger..."
2. In the dialog choose "Global compiler settings"
3. Select the compiler "Digital Mars D Compiler"
4. Go to "Linker settings" tab
5. Optional: change "phobos" to "phobos2" in the "Link libraries" if you use
dmd-2.xx
6.
Add "-g -m32 -Xlinker /opt/dmd/lib/libphobos2.a -Xlinker -L/opt/dmd/bin/../lib"
to the "Other linker options"
7. Go to "Search directorries" tab and choose "Linker" tab
8. Set your search directories. (For Gentoo: "/opt/dmd/lib" and "/usr/lib"
must be set.)
9. Go to "Toolchain executables" tab
10. Set the correct path for your dmd installation. (For Gentoo "/opt" must
be set.)
11. In the "Program Files" tab set the following values:
"C compiler" -> "dmd"
"C++ compiler" -> "dmd"
"Linker for dynamic libs" -> "gcc"
"Linker for static libs" -> "gcc"
"Debugger" -> "gdb"
"Resource compiler" -> "" (optional)
"Make program" -> "make"
12. In the "Additional Paths" tab add the installation path of the GNU
toolchain (gcc, make, gdb). (For Gentoo "/usr" must be set.)
13. Go to "Other settings" tab
14. Choose "Advanced options..."
15. On the "Commands" tab select "Compile single file to object file" from
teh combo box. Be sure that the "command line macro" is set to "$compiler
$options $includes -c $file -of$object". Mind the -of switch for $object!

These are the basic compiler settings, to make the compiler work.
Additionally you can set any compiler switches as you like, or define
resource compiler, or additional include paths for libraries and soruces,
etc. But normally these settings are project specific, therefore they
should go to the "Project -> Properties..".

+1:
I encountered an interesting issue in the project settings, which I could
only solve with a small workaround. If I set the "Output filename" in
the "Project -> Properties..." dialog box on the "Build targets" tab
to "<outputfilename>", the generated output file will be
named "f<outputfilename>". So I put the "mv f<outputfilename>
<outputfilename>" line in the "Project -> Build options..." dialog box on
the "Pre/post build steps" tab to the "Post build steps".

Any comments are welcome!

David
June 25, 2008
Re: CodeBlocks
David Ferenczi wrote:
> I encountered an interesting issue in the project settings, which I could
> only solve with a small workaround. If I set the "Output filename" in
> the "Project -> Properties..." dialog box on the "Build targets" tab
> to "<outputfilename>", the generated output file will be
> named "f<outputfilename>". So I put the "mv f<outputfilename>
> <outputfilename>" line in the "Project -> Build options..." dialog box on
> the "Pre/post build steps" tab to the "Post build steps".

I think this is due to the mixing of DMD and GCC when compiling/linking,
i.e. if one passes -of<outputfilename> to gcc, that will be the result.

--anders
June 25, 2008
Re: CodeBlocks
Anders F Björklund wrote:

> David Ferenczi wrote:
>> I encountered an interesting issue in the project settings, which I could
>> only solve with a small workaround. If I set the "Output filename" in
>> the "Project -> Properties..." dialog box on the "Build targets" tab
>> to "<outputfilename>", the generated output file will be
>> named "f<outputfilename>". So I put the "mv f<outputfilename>
>> <outputfilename>" line in the "Project -> Build options..." dialog box on
>> the "Pre/post build steps" tab to the "Post build steps".
> 
> I think this is due to the mixing of DMD and GCC when compiling/linking,
> i.e. if one passes -of<outputfilename> to gcc, that will be the result.
> 
> --anders

Yes, it may be the problem, but I'm not sure if it can be really influenced
by the configuration. The linking command looks like:

$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options
$libs

CodeBlocks separates compiling and linking, and in my configuration gcc is
called directly for linking with the -o switch. DMD is only used when
making the individual object files, where the -of switch is used.

David
June 26, 2008
Re: CodeBlocks
> 15. On the "Commands" tab select "Compile single file to object file" from
> teh combo box. Be sure that the "command line macro" is set to "$compiler
> $options $includes -c $file -of$object". Mind the -of switch for $object!
> 

As a small note, I'd recommend to use "-od$objects_output_dir" instead 
of "-of$object". That way, the -op switch for dmd will also work.
June 26, 2008
Re: CodeBlocks
Sönke Ludwig wrote:

>> 15. On the "Commands" tab select "Compile single file to object file"
>> from teh combo box. Be sure that the "command line macro" is set to
>> "$compiler $options $includes -c $file -of$object". Mind the -of switch
>> for $object!
>> 
> 
> As a small note, I'd recommend to use "-od$objects_output_dir" instead
> of "-of$object". That way, the -op switch for dmd will also work.

If you use -od$objects_output_dir", but don't use the -op switch, the linker
won't find the object files. (At least in my configuration.)
June 26, 2008
Re: CodeBlocks
David Ferenczi schrieb:
> Sönke Ludwig wrote:
> 
>>> 15. On the "Commands" tab select "Compile single file to object file"
>>> from teh combo box. Be sure that the "command line macro" is set to
>>> "$compiler $options $includes -c $file -of$object". Mind the -of switch
>>> for $object!
>>>
>> As a small note, I'd recommend to use "-od$objects_output_dir" instead
>> of "-of$object". That way, the -op switch for dmd will also work.
> 
> If you use -od$objects_output_dir", but don't use the -op switch, the linker
> won't find the object files. (At least in my configuration.)

I see - CodeBlocks seems to assume -op in case of -od... unfortunate 
that -od/-op is not the default behaviour, since it's not that uncommon 
to have multiple modules with the same name.
July 20, 2008
Re: CodeBlocks
David Ferenczi Wrote:

> I have managed to get CodeBlocks 8.02 work with dmd-2.012 under linux. It
> wasn't obviouos (at least for me), so if someone is interested, I could
> make a short howto.

Someone has already done this:

http://d.whosme.de/index.php?language=en&site=tutorials

It's for windows, but I think most of it applies to both. And this German guy made many more video tutorials, which saved me from going out of my mind as a begginer.

Tomek
July 20, 2008
Re: CodeBlocks
On Mon, 21 Jul 2008 01:05:11 +0400, Tomasz Sowiñski <tomeksowi@gmail.com>  
wrote:

> David Ferenczi Wrote:
>
>> I have managed to get CodeBlocks 8.02 work with dmd-2.012 under linux.  
>> It
>> wasn't obviouos (at least for me), so if someone is interested, I could
>> make a short howto.
>
> Someone has already done this:
>
> http://d.whosme.de/index.php?language=en&site=tutorials
>
> It's for windows, but I think most of it applies to both. And this  
> German guy made many more video tutorials, which saved me from going out  
> of my mind as a begginer.
>
> Tomek

Wow, it's awesome! A link to these tutorials should definitely be posted  
somewhere on digitalmars.com
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home