Author Topic: Is it possible to remove compilers from the default list  (Read 5903 times)

Offline pabristow

  • Multiple posting newcomer
  • *
  • Posts: 75
Is it possible to remove compilers from the default list
« on: July 08, 2021, 12:15:51 pm »
I'd really like to remove all the unused (and not useful to me) compilers, leaving just the handful of very shiny new that I use, preferably at least at the top or bottom so that finding them is quicker.

<aside> What controls the order of compilers? </aside>

But when I try remove unwanted compilers using CB, Settings, Compiler, chose Borland (say), the option for delete is grayed out.

If I use force majeur and delete the <bcc> ... </bcc> section, Codeblocks helpfully(?) restores it!

So this is hardcoded somewhere?  Any suggestions on really removing unwanted compilers?

(I realize that installing new versions may restore the full default list).

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Is it possible to remove compilers from the default list
« Reply #1 on: July 08, 2021, 01:06:48 pm »
Try going to
Code
share\CodeBlocks\compilers
and move the unwanted compiler (compiler_xxx.xml) out of the folder

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Is it possible to remove compilers from the default list
« Reply #2 on: July 08, 2021, 01:29:34 pm »
I have been working on an option to only show the detected compilers in the compiler drop down list. I have finished the initial development and done the first pass of testing this afternoon (OZ time). I will be pushing the changes to the following github branch once I do more testing in a few days, which I hope will eventually be the solution for ticket 1111. See attached PNG for example of the result of the list change (there are also changes for the add/copy/delete/rename for index changes).
https://github.com/acotty/codeblocks_sf/tree/AC-CompilerDialogDetectedOption

Tomorrow I will also be pushing a similar change to the auto detected dialog to the following branch, which I hope will eventually be the solution for ticket 1117.
https://github.com/acotty/codeblocks_sf/tree/AC-AutoDetectCompilerStartup

Tomorrow I will also be pushing my latest compiler XML file to the following branch, which I hope will eventually be the solution for ticket 374.
https://github.com/acotty/codeblocks_sf/tree/AC-AdditionalWindowsCompilerDefs

These changes should help you out allot as the list is way way to big to be usable IMHO and it is worse for newbies.

Okay the order is decided by the weighting in the compiler XML file if you read the WIKI, but I have not spotted this in the code yet. Watch out as I got errors when I deleted some of the compiler XML files before I made the changes as they were getting in the way like you have seen.

Can you add the remove issue to ticket 1111. The force majeur I do is to "rmdir /q /s %APPDATA%\CodeBlocks" BUT BUT it will remove you debugger settings and global variables, but will fix the compiler quirks yo cause when testing new compiler XML and then stuff up the compiler settings. The another option, which may be better is to delete the <compiler><sets> in the  %APPDATA%\CodeBlocks\default.conf file and see how CB reacts as this is where the compiler info is stored.

Let me know if you want the AC-CompilerDialogDetectedOption as they are and I will push them up tomorrow.

Let me know how you get on.
« Last Edit: July 08, 2021, 01:33:49 pm by AndrewCot »

Offline pabristow

  • Multiple posting newcomer
  • *
  • Posts: 75
Re: Is it possible to remove compilers from the default list
« Reply #3 on: July 08, 2021, 02:12:32 pm »
Renaming some files in "C:\Program Files\CodeBlocks\share\CodeBlocks\compilers" from .xml to .xml.old seems to reduce the clutter level for me, but AndrewCot's changes look like a proper solution, perhaps for the next Codeblocks revision/release?

<aside> As a Windows user, I find https://winlibs.com/ an invaluable site for downloads of pre-built binaries for Windows for mingw-64 and GCC, more recently 11.1.0.  And for LLVM the https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/LLVM-12.0.0-win64.exe  I downloaded/copied to C:\LLVM\clang-1200\LLVM and used this for the executable containing the /bin folder.  This gives access to the gleaming newest versions and latest C++ standard versions, and hoping the least bugs. </aside>

I'm puzzled why the Settings/Compiler/ delete option is greyed out.

Also the compiler order is still a mystery to me.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Is it possible to remove compilers from the default list
« Reply #4 on: July 08, 2021, 02:38:30 pm »
The delete option should be enabled only for compilers you created, not for built-in ones.

The order is given in the weight field of the XML entry, bigger number means later in the list:
Code
<CodeBlocks_compiler name="Borland C++ Compiler (5.5, 5.82)"
                     id="bcc"
                     weight="20"
                     platform="windows">

Offline pabristow

  • Multiple posting newcomer
  • *
  • Posts: 75
Re: Is it possible to remove compilers from the default list
« Reply #5 on: July 09, 2021, 10:34:48 am »
Ah ha!  I see (and perhaps - Duh - I should have figured this out   ::))  Thanks for this useful info.

1  Can I safely change the weighting to place my 'favorites' together at the top (or bottom)?

(avoiding two with the same weight?)

2 Does the delete option simply delete the appropriate %appdata%/codeblocks/ .xml file?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Is it possible to remove compilers from the default list
« Reply #6 on: July 09, 2021, 11:23:08 am »
Quote
Can I safely change the weighting to place my 'favorites' together at the top (or bottom)?
Yes.
Quote
Does the delete option simply delete the appropriate %appdata%/codeblocks/ .xml file?
The relevant code is this:
Code
void CompilerFactory::RemoveCompiler(Compiler* compiler)
{
    if (!compiler || compiler->m_ParentID.IsEmpty())
        return;
    Manager::Get()->GetConfigManager(_T("compiler"))->DeleteSubPath(_T("/user_sets/") + compiler->GetID());

    Compilers.Remove(compiler);
    Manager::Get()->GetLogManager()->DebugLog(F(_T("Compiler \"%s\" removed"), compiler->GetName().wx_str()));

    Compiler::m_CompilerIDs.Remove(compiler->GetID());
    delete compiler;

    SaveSettings();
}
Looks like it is removed from the settings (default.conf), but not from the disk.

Offline pabristow

  • Multiple posting newcomer
  • *
  • Posts: 75
Re: Is it possible to remove compilers from the default list
« Reply #7 on: July 09, 2021, 07:02:51 pm »
Thanks, I can now reduce the list to remove compilers that are not of interest to me.

(Until the next release  ;) )

It is impressive to have such a lot of compilers on offer (and the ability to add new one reasonably easily) but would be nice to be able to put aside 'uninteresting' compilers into a 'saved' folder.  I'll leave that for the experts to ponder.

Meanwhile many thanks.