Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: CodeBlocky on June 14, 2021, 08:38:55 am
-
I installed Code:Blocks for Windows and it detected the gcc C compiler and Digital Mars D compilers on my system. But when I created a D program and went to compile it Code::Blocks had set the GNU D compiler (GDC) as the compiler to use. That is not on my system and it failed. So I went and changed the compiler for the project to the DMD compiler. However, trying to compile with the Digital Mars compiler fails because Code::Blocks is putting a compiler option of -Wall which DMD does not support. I cannot see that setting in the Project->Build Options->Compiler Settings so I don't know how to get rid of it.
-
You can look also in Settings -> Compiler
-
You can look also in Settings -> Compiler
Thanks for the reply. If I go there it gives me the settings which only apply to the DMD Windows compiler and there is no -Wall option and the "Other compiler options" tab is blank.
I notice that my "cbp" file was not updated when I changed the compiler in Code::Blocks. That file still thinks I am using gdc and has the -Wall option in it:
<Compiler>
<Add option="-Wall" />
</Compiler>
And yet doing a build invokes the DMD compiler??
But apparently it is ignoring that file as when I removed -Wall from it and set the correct compiler it still invokes DMD with the -Wall option.
I got out of Code::Blocks and back in and it still wants to add -Wall to a command line that is invoking DMD, which does not support that option.
------------------------------------------
I relooked at the cbp file and while I thought I had removed the -Wall option, it was still there. I removed it (again?) and then I was able to get a successful compile.
-
This can be edited in the GUI using Project -> Build options -> [target or project] -> Compiler settings -> Other compiler settings
-
This can be edited in the GUI using Project -> Build options -> [target or project] -> Compiler settings -> Other compiler settings
Thanks for the reply. I looked at that tab, but it was blank/empty.
-
Before or after editing the cbp file with a text editor?
I suppose the Compiler Flags tab doesn't have a "-Wall" option.
Keep in mind that these compilers are rarely used in codeblocks, so they might be outdated.
Also keep in mind that last time (12+ years ago) I've tried D in C::B the dependency tracking didn't work well/at all, so you might need to do full rebuilds every time you change something major.
-
Before or after editing the cbp file with a text editor?
Before and after.
I suppose the Compiler Flags tab doesn't have a "-Wall" option.
It has one if I change the compiler back to GNU GDC.
I may have been able to solve my problem with it using a DMD compiler and GDC flags if I had saved the project to update the project file to DMD. Although I am not sure how it would use a mix of program settings and project file settings. But I can't test that now because, while it started up initially with GDC as the default, now it won't let me switch to GDC as the default because it correctly says that it can't find it on my system.
-
When switching compilers C::B tries to match flags set for the old compiler in the new compiler.
If a flag is found in the new compiler it is set and you see a checkbox in the Flags tab.
If it is not found it is transferred as a string option in the "Other compiler options".
-
I tried to duplicate the issue by uninstalling and re-installing Code::Blocks. But apparently just getting rid of C:\Program Files\CodeBlocks (via an uninstall) is not enough. There appears to be some other file which is in my user space which the uninstall misses, because this time the same install executable behaved differently. It did not tell me what compilers it had found on my system on first usage/setup. And the default compiler setting on startup is Digital Mars D (DMD).
-
There is a CodeBlocks\default.conf in you AppData somewhere. Any modern software doesn't store user preferences next to the installation. They are all per user.
-
There is a CodeBlocks\default.conf in you AppData somewhere. Any modern software doesn't store user preferences next to the installation. They are all per user.
OK. I believe some programs will ask to delete files like that during an uninstall which is ideal.
But anyway, I deleted the AppData/Roaming/CodeBlocks directory and did a reinstall and this time I did ultimately see -Wall in "Other compiler options" and when I deleted it the compile succeeded. Thanks for the assistance!
There is the minor issue that Code::Blocks only detects the GNU GCC C Compiler and Digital Mars D compiler on first startup, but when I create a D project it tries to build it with the GNU GDC D compiler.
-
You can select the compiler while you create the project. Isn't this the case for D projects?