Author Topic: DMD compiler problems... -Wall option?  (Read 28099 times)

Offline Silverling

  • Multiple posting newcomer
  • *
  • Posts: 18
DMD compiler problems... -Wall option?
« on: November 22, 2006, 10:17:19 pm »
When I try to compile, even the simplest D program, the compiler goes like this:

dmd.exe -Wall -w -g  -IC:\dmd\src\phobos  -c main.d -ofobj\Debug\main.obj
Error: unrecognized switch '-Wall'

Ok, I lost more than 30 mins searching of the -Wall option on the compiler settings, but there is none. No check box to enable/disable with this parameter. What should I do?!

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: DMD compiler problems... -Wall option?
« Reply #1 on: November 22, 2006, 10:33:57 pm »
There is no "-Wall" in DMD settings, so the "-w" flag you have there is good enough...
Maybe the flag was added explicitly ? Check the .cbp XML file directly as a last resort.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #2 on: November 22, 2006, 11:12:37 pm »
Ok, I lost more than 30 mins searching of the -Wall option on the compiler settings, but there is none. No check box to enable/disable with this parameter. What should I do?!
There is one (I swear!) in one of these places:
1.) Settings -> Compiler and Debugger -> [Your D Compiler] -> Tab "Compiler" -> Tab "Other options"
2.) [Your project's build options] -> Tab "Compiler" -> Tab "Other options"
3.) [Your project's target's build options] -> Tab "Compiler" -> Tab "Other options"

C::B does *only* apply the settings you have setup in your project, nothing else. You *will* find the -Wall settings somewhere.

I guess this happened because you have started to create a "C/C++" project and then changed the compiler to "D"... right?

With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Silverling

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: DMD compiler problems... -Wall option?
« Reply #3 on: November 22, 2006, 11:13:42 pm »
Yep. The -Wall option is set on the project file. Is this a C::B bug? I just started using C::B and programming D.

And no, I choose Digital Mars D compiler right from the beginning.

By the way. Now that I have replaced the line, it complays that it cannot find "c:\dmd\bin\..\..\dmd\bin\linker.exe"
True, there is no such file, but the linker on the options page is the "dmd.exe" file. Why does it search for linker!?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #4 on: November 22, 2006, 11:15:53 pm »
Yep. The -Wall option is set on the project file. Is this a C::B bug?
Depends. Did you use the wizard to create a "D" application? There is a known bug in the wizard (IMHO also reported in the bug tracker)... BTW: It's assigned to me I'd say... :oops: :lol:
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Silverling

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: DMD compiler problems... -Wall option?
« Reply #5 on: November 22, 2006, 11:28:17 pm »
I began by starting a OpenGL application with DMD as the compiler, but the code was C, so I deleted the project and started a "empty project" and selected DMD. The I created a new file, pasted all the code from the example at digital mars and tried to compile. The errors then appeared. By the way, the -Wall option is nowhere to be found. If it does exist, send me a screenshot (lol, looks like I'm daring you :P).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #6 on: November 22, 2006, 11:41:33 pm »
By the way, the -Wall option is nowhere to be found. If it does exist, send me a screenshot (lol, looks like I'm daring you :P).
What do you mean? So it's still in your project? If so, please strip down your project and attach (zipped) to  another post into this thread. Then I can tell you where this option get's set.
...if you mean something else: Please give me a detailed step-by-step instruction how to reproduce. From what I see the "-Wall" option for a "D" project only get's set, if you choose the gdc compiler (GNU D compiler) and *not* DMD (Digital Mars D compiler). For the first choice this should be correct, as the GNU compiler does indeed offer the -Wall option... AFAIK.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Silverling

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: DMD compiler problems... -Wall option?
« Reply #7 on: November 23, 2006, 12:03:08 am »
Here is my project. Altered mind you. I opened the project file with WordPad and removed the compiler option -Wall (it was between <compiler> and </compiler> something addOption="-Wall").

[attachment deleted by admin]

Offline Silverling

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: DMD compiler problems... -Wall option?
« Reply #8 on: November 23, 2006, 02:53:30 am »
On the new project Dialog I choose the DMD compiler (and I also configure the compiler on the compilers&debuggers config box). Uppon starting a new project and attempting to compile,the -Wall option pops.

Oh well. Any clues of when will these DMD problems be fixed? The linker doesn't work either, as I said before.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #9 on: November 23, 2006, 08:42:36 am »
Ok - opening your original project file (renamed *.save to *.cbp) I found where the switch is placed - in the project's compiler #define section (see image attached).

Now I'm not sure how it got there because it usually should be under "Other options" but again: There is *never-ever* a need to modify the project file manually. Everything from the project file you can adjust somewhere.
So it seems as if I have to install a D compiler, right? I don't remember who did the "D" wizard but I still believe that in case of the "DMD" this option should not be automatically created... anyway - I'll try.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #10 on: November 23, 2006, 09:20:22 am »
Ok - I'm through now and to sum up: It works!
Here the simple steps that I've done to attach the Digital Mars D compiler and using the wizard to create a hello world application without any trouble:
1.) D/L dmd.zip and dmc.zip and extracted them in a directory (just as suggested on the DMD homepage at http://www.digitalmars.com/d/dcompiler.html).
--> This created two sub-folders "dm" and "dmd"
2.) Setup the DMD compiler in C::B:
- set the base path to [DMD]\dmd
- add additional path [DMD]\dm\bin
- setup the compiler include path to [DMD]\dmd\src\dmd and [DMD]\dmd\src\phobos
- setup the linker include path to [DMD]\dmd\lib and [DMD]\dm\lib
- left everything else as it is.
3.) Started the D application wizard, selected "DMD" as compiler --> compiles and runs just fine... no illegal switches, nothing. What is your problem???
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Silverling

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: DMD compiler problems... -Wall option?
« Reply #11 on: November 23, 2006, 01:38:27 pm »
Yep, the option is there. I didn't find it because it wasn't under a Build Option specifically. However, I meddle overmuch with the compiler options and there is no "Reset" button :$:$:$ Sorry... I tried to uninstall B::C and delete the config records on the system registry, but my settings remained there... How do I reset all compiler settings?

By the way, I can now find the linker. The DMD package with the linker extracted all files to another folder called "DM" instead of "DMD", so the linker didn't get in place (at least where C::B searched). I corrected that already.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #12 on: November 23, 2006, 02:00:10 pm »
How do I reset all compiler settings?
If you are using the nightly build than there is no registry usage at all. In that case goto "Documents and settings\[your_user_id]\Application Data\codeblocks" and delete all *.conf files (in fact usually there is only one: default.conf unless you are using different layouts).

By the way, I can now find the linker. The DMD package with the linker extracted all files to another folder called "DM" instead of "DMD", so the linker didn't get in place (at least where C::B searched). I corrected that already.
BTW: It isn't C::B searching there bit the DMD compiler itself. So DMD is the one to blame for this issue. But actually this is described in detail how it works on their webpage and if the software is installed as proposed there is no such issue...

With regards, Morten.

Ps.: After that discussion what's actually left to clarify/fix...?! I'm a bit lost now... ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: DMD compiler problems... -Wall option?
« Reply #13 on: November 23, 2006, 04:38:21 pm »
Hi,

This bug exists for Borland C++ Compiler 5.5 too. To reproduce the bug, click File -> New -> Project, select Console Application and later select Borland C++ 5.5 compiler. A default project with some code will be generated. Try building it, you'll get the following message.

Quote
:: === TestApp, Debug ===
:: Error E2075: Incorrect command line option: -Wall
:: === Build finished: 1 errors, 0 warnings ===

You won't get the option in Build Options dialog but the error will keep coming up. Now close the project and open the project file in Notepad++ or similar app, you'll see the following lines.
Code
			<Target title="Release">
<Option output=".\TestApp.exe" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Release\" />
<Option type="1" />
<Option compiler="bcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="main.cpp">
<Option compilerVar="CPP" />
<Option target="Debug" />
<Option target="Release" />
</Unit>

Remove the code in between
Code: xml
<compiler></compiler>
and save the file. Now it will compile without any problem.

I am using Code::Blocks (svn build rev 3253 (2006-11-21 13:59:39) gcc 3.4.5 Windows/unicode)

Regards,

Biplab Kumar Modak
« Last Edit: November 23, 2006, 04:39:54 pm by biplab »
Be a part of the solution, not a part of the problem.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: DMD compiler problems... -Wall option?
« Reply #14 on: November 23, 2006, 05:18:09 pm »
the project wizard script should be checked, probably add this options in too many cases --> probably only valid for gnu ?

Offline Silverling

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: DMD compiler problems... -Wall option?
« Reply #15 on: November 23, 2006, 05:18:47 pm »
All problems seem to have been solved. A few bugs however I want to point out. I choose DMD as the default compiler,but he ignored me :shock:. No big deal, I simply choose the one appropriate when creating a new project. Now,when I add a file, I have to specifically change it's extension from the default c/c++ to .d He should assume the extension from the compiler...

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: DMD compiler problems... -Wall option?
« Reply #16 on: November 23, 2006, 05:30:54 pm »
All problems seem to have been solved. A few bugs however I want to point out. I choose DMD as the default compiler,but he ignored me :shock:. No big deal, I simply choose the one appropriate when creating a new project. Now,when I add a file, I have to specifically change it's extension from the default c/c++ to .d He should assume the extension from the compiler...
this is very valuable feedback. Please create for each a bug report at berlios, and specify a detailed "how to reproduce".
Many thanks

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #17 on: November 23, 2006, 06:00:48 pm »
the project wizard script should be checked, probably add this options in too many cases --> probably only valid for gnu ?
The reason is simple: There is a common function that handles setting the "enable warnings". It's function is basically "If MSVC -> (Set For MSVC) Otherwise FallBack to GNU (GCC) default".
This works in more cases than e.g. "If MSVC -> (Set For MSVC) Else If GNU (GCC) -> Do "-Wall" Otherwise FallBack to nothing."
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: DMD compiler problems... -Wall option?
« Reply #18 on: November 23, 2006, 09:43:41 pm »
I suggest we enhance it for our build in compilers, we already know now it's not ok for Borland and Dmd

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #19 on: November 23, 2006, 10:31:35 pm »
I suggest we enhance it for our build in compilers, [...]
I'm not quite sure what that means (you mean the new compiler framework, right?) but yes... why not. ;-)
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: DMD compiler problems... -Wall option?
« Reply #20 on: November 23, 2006, 11:12:28 pm »
no, I was talking to do that if this else if this, else if this, else default in the wizard script on when to add -Wall. Where the if this is at least the compilers which have built-in support in CB

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #21 on: November 23, 2006, 11:52:56 pm »
no, I was talking to do that if this else if this, else if this, else default in the wizard script on when to add -Wall. Where the if this is at least the compilers which have built-in support in CB
Right... so you mean we should really extend the wizard script for all built-in compilers? Ok - will do this... hopefully I understand what compiler switch is meant to be the "Warning all" for all supported compilers... ;-)
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: DMD compiler problems... -Wall option?
« Reply #22 on: November 24, 2006, 04:39:57 am »
The bug (-Wall for Borland) does not exist for MSVC.

Also as Silverling posted, even if the default compiler is set to a compiler other than GNU GCC, the project wizard always takes GCC as default.
Be a part of the solution, not a part of the problem.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #23 on: November 24, 2006, 09:10:40 am »
[...] even if the default compiler is set to a compiler other than GNU GCC, the project wizard always takes GCC as default.
Please file a bug report accordingly and (if possible) assign to me or tell me. Otherwise this will get lost. But I agree - this shouldn't happen. (Will think about that.)
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: DMD compiler problems... -Wall option?
« Reply #24 on: November 24, 2006, 10:47:56 am »
I have added two bug reports in Berilios. They are as follows-

  • [ Bug #9533 ] Default Compiler is always set to GCC
  • [ Bug #9534 ] -Wall Option in project file of Borland C++ and DMD compiler

I have added short description to reproduce the bug.  :D
Be a part of the solution, not a part of the problem.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DMD compiler problems... -Wall option?
« Reply #25 on: November 24, 2006, 11:50:10 am »
I have added two bug reports in Berilios. They are as follows-
Ok - thanks, I've assigned them to me so they shouldn't get lost.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: DMD compiler problems... -Wall option?
« Reply #26 on: November 24, 2006, 02:51:27 pm »
Hi MortenMacFly,

I have created a partial patch.

File to be patched: common_functions.script
Quote
12c12
<     else
---
>    else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
16a17,21
>    else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
>    {
>       // Set option for genearting all warnings with BCC
>       base.AddCompilerOption(_T("-w"));
>    }
28c33
<     else
---
>     else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
44c49
<     else
---
>     else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
59c64
<     else
---
>     else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))


The patch solves Bug #9534. But the one can't build app with bcc as several compiler and linker options are missing from the project file as it was never added by the project wizard. I can find the support for Borland Compiler is broken. That is why I call this a partial patch.

Some more work needs to be done in order to fix the building and linking properly. I have modified some of the code to not to block some wrong options to be set for bcc (like -g, which has different meaning in bcc).

Regards,

Biplab Kumar Modak
Be a part of the solution, not a part of the problem.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: DMD compiler problems... -Wall option?
« Reply #27 on: November 24, 2006, 07:38:44 pm »
I'm posting more polished patches.

Latest Changes:
  • Bug #9534 is fixed.
  • Improvements to Console Wizards

Console Wizard Improvements:
  • Adds exception handling compiler flags for GCC, MSVC 2005 (MSVC 2003 not tested) and Borland C++ 5.5.1 compilers. (Earlier wizard script had a function, but the call was not being executed. The function have been improved and added appropriately to wizard)
  • Adds appropriate Optimization compiler flags for GCC, MSVC 2005 (MSVC 2003 not tested) and Borland C++ 5.5.1 compilers. (Earlier wizard script had a function, but the call was not being executed. The function have been improved and added appropriately to wizard)
  • Adds appropriate libraries for linking with MSVC 2005 and Borland C++ 5.5.1 compilers. (Linking with MSVC 2003 may face problem)

What it Broke??  :shock:
  • The /NODEFAULTLIB:libcmt.lib flag has been added. I'm not sure whether this will work for MSVC 6 or MSVC 2003. This is necessary to compile app with MSVC 2005.
  • Other compiler flags may break MSVC 6 and MSVC 2003 support (I'm not sure as I don't have them to test).

I'll make improvements to this patch after my upcoming exam.. :D

Patches:
common_functions.patch (Patch #001657 submitted in Berlios)
Code: cpp
--- C:/CB_20061121_rev3253_win32/share/CodeBlocks/templates/wizard/old_common_functions.script	Tue Jul 25 21:05:04 2006
+++ C:/CB_20061121_rev3253_win32/share/CodeBlocks/templates/wizard/common_functions.script Sat Nov 25 02:01:18 2006
@@ -5,31 +5,44 @@
 // Warnings On
 function WarningsOn(base, compilerID)
 {
-    if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
+ if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
     {
         base.AddCompilerOption(_T("/W3"));
     }
-    else
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
     {
         // GCC options are used as fallback
         base.AddCompilerOption(_T("-Wall"));
     }
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+ {
+ // Set option for genearting warnings with BCC
+ base.AddCompilerOption(_T("-w"));
+ }
 }
 
 // Debug symbols On
 function DebugSymbolsOn(base, compilerID)
 {
-    if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
+ if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
     {
         base.AddCompilerOption(_T("/Zi"));
         base.AddCompilerOption(_T("/D_DEBUG"));
         base.AddLinkerOption(_T("/DEBUG"));
+ base.AddLinkerOption(_T("/NODEFAULTLIB:libcmt.lib"));
+ base.AddLinkLib(_T("libcmtd.lib"));
     }
-    else
+    else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
     {
         // GCC options are used as fallback
         base.AddCompilerOption(_T("-g"));
     }
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+    {
+        // BCC options for generating debug symbols
+        base.AddCompilerOption(_T("-v"));
+ base.AddLinkerOption(_T("-v"));
+    }
 }
 
 // Optimizations On
@@ -40,13 +53,19 @@
         base.AddCompilerOption(_T("/Og"));
         base.AddCompilerOption(_T("/Ox"));
         base.AddCompilerOption(_T("/DNDEBUG"));
+ base.AddLinkLib(_T("libcmt.lib"));
     }
-    else
+    else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
     {
         // GCC options are used as fallback
         base.AddCompilerOption(_T("-O2"));
         base.AddLinkerOption(_T("-s"));
     }
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+    {
+        // BCC options for optimizations
+        base.AddCompilerOption(_T("-O2"));
+    }
 }
 
 // C++ Exceptions On
@@ -56,11 +75,34 @@
     {
         base.AddCompilerOption(_T("/EHsc"));
     }
-    else
+    else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
     {
         // GCC options are used as fallback
         base.AddCompilerOption(_T("-fexceptions"));
     }
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+    {
+        // BCC options for exceptions. Not Tested
+        base.AddCompilerOption(_T("-x"));
+    }
+}
+
+//To include additional Libraries needed for linking
+function IncludeAdditionalLib(base, compilerID)
+{
+ if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
+ {
+ //Add any library which is needed
+ }
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
+ {
+ //Add any library which is needed
+ }
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+ {
+ base.AddLinkLib(_T("cw32mt.lib"));
+ base.AddLinkLib(_T("import32.lib"));
+ }
 }
 
 function VerifyDirectory(dir_or_macro)

wizard.patch (Patch #001656 submitted in Berlios)
Code: cpp
--- C:/CB_20061121_rev3253_win32/share/CodeBlocks/templates/wizard/console/old_wizard.script	Sat Nov 25 01:15:26 2006
+++ C:/CB_20061121_rev3253_win32/share/CodeBlocks/templates/wizard/console/wizard.script Sat Nov 25 01:27:49 2006
@@ -97,13 +97,21 @@
     // Debug build target
     local target = project.GetBuildTarget(Wizard.GetDebugName());
     if (!IsNull(target))
+ {
         SetupTarget(target, true);
+ CppExceptionsOn(target, Wizard.GetCompilerID());
+ IncludeAdditionalLib(target, Wizard.GetCompilerID());
+ }
 
     // Release build target
     target = project.GetBuildTarget(Wizard.GetReleaseName());
     if (!IsNull(target))
+ {
         SetupTarget(target, false);
-
+ CppExceptionsOn(target, Wizard.GetCompilerID());
+ IncludeAdditionalLib(target, Wizard.GetCompilerID());
+ }
+
     // all done!
     return true;
 }
@@ -124,12 +132,14 @@
     if (is_debug)
     {
         // enable debugging symbols for this target
-        DebugSymbolsOn(target, Wizard.GetTargetCompilerID());
+        //DebugSymbolsOn(target, Wizard.GetTargetCompilerID());
+ DebugSymbolsOn(target, Wizard.GetCompilerID());
     }
     else
     {
         // enable optimizations for this target
-        OptimizationsOn(target, Wizard.GetTargetCompilerID());
+        //OptimizationsOn(target, Wizard.GetTargetCompilerID());
+ OptimizationsOn(target, Wizard.GetCompilerID());
     }
 
     // all done!

Results of Some Test Applications:
Quote
-------------- Build: Debug in TestBor ---------------
Compiling: main.cpp
main.cpp:
Linking console executable: .\TestBor.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

-------------- Build: Release in TestBor ---------------
Compiling: main.cpp
main.cpp:
Linking console executable: .\TestBor.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

-------------- Build: Debug in TestVC ---------------
main.c
Linking console executable: .\TestVC.exe
LINK : .\TestVC.exe not found or not built by the last incremental link; performing full link
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

-------------- Build: Release in TestVC ---------------
cl : Command line warning D9035 : option 'Og' has been deprecated and will be removed in a future release
main.c
Linking console executable: .\TestVC.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
 
-------------- Build: Debug in TestVC ---------------
main.cpp
Linking console executable: .\TestVC.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

-------------- Build: Release in TestVC ---------------
cl : Command line warning D9035 : option 'Og' has been deprecated and will be removed in a future release
main.cpp
Linking console executable: .\TestVC.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

-------------- Build: Debug in TestGCC ---------------
Compiling: main.cpp
Linking console executable: .\TestGCC.exe
Process terminated with status 0 (0 minutes, 3 seconds)
0 errors, 0 warnings
 
-------------- Build: Release in TestGCC ---------------
Compiling: main.cpp
Linking console executable: .\TestGCC.exe
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings

You can see that all the test applications generated by the wizard compiled with GCC, MSVC 2005 and Borland C++ 5.5.1 without any error or warnings.

Please test it and post your feedback.

Regards,

Biplab Kumar Modak
« Last Edit: November 24, 2006, 07:52:18 pm by biplab »
Be a part of the solution, not a part of the problem.

Offline heromyth

  • Multiple posting newcomer
  • *
  • Posts: 98
    • http://
Re: DMD compiler problems... -Wall option?
« Reply #28 on: November 30, 2006, 10:04:38 am »
There are so many guys discussing this problem! The D is getting hotter and hotter :P. I have been planning to solve it. It seems to be unnecessary.

I want to give a suggestion :
    The D is just a language like C or C++, and can also be used for programming in Console and GUI (wxD now works.) environment. Maybe we can delete the catalog item of "D application", and add it to Console and GUI.

By the way, I want to give another my problem that is I can't use the GDC compiler in FreeBSD after I have installed GDC. Of course, I'll try my best to solve it.
« Last Edit: November 30, 2006, 10:07:27 am by heromyth »

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: DMD compiler problems... -Wall option?
« Reply #29 on: November 30, 2006, 10:17:43 am »
I want to give a suggestion :
    The D is just a language like C or C++, and can also be used for programming in Console and GUI (wxD now works.) environment. Maybe we can delete the catalog item of "D application", and add it to Console and GUI.

Currently D is a C/C++ compiler in Code::Blocks. Once that bug/workaround/hack is fixed, we can update the wizards.