Author Topic: Lost compiler flags in Build options.  (Read 29485 times)

Offline Sagaceil

  • Single posting newcomer
  • *
  • Posts: 9
Lost compiler flags in Build options.
« on: April 22, 2014, 11:56:40 pm »
Hello,

Recently I notices lack of common compiler flags in build options window :



I know that I can add flags manualy under "Another options" tab, but ability to select a few sets is great ;P
Is there any reason that those options gone ? I'm using latest nightly and I cloned common GCC compiler to be able to select my own folders. What is strange, that the original compiler (build in GNU GCC preset) hasn't those flags too. I'm wondering if the latest nightly changed something in setups of that flags.

Is there any simple solution to restore all that options ? Mayby some config file ?
Thanks, for any help :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Lost compiler flags in Build options.
« Reply #1 on: April 23, 2014, 12:57:17 am »
Do you have any options_*.xml files in your %app_data%/codeblocks folder?
(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!]

Offline Sagaceil

  • Single posting newcomer
  • *
  • Posts: 9
Re: Lost compiler flags in Build options.
« Reply #2 on: April 23, 2014, 01:49:30 pm »
Yes, there is : AppData\Roaming\CodeBlocks\share\codeblocks\compilers\options_gcc.xml

Code
<?xml version="1.0" encoding="utf-8"?>
<CodeBlocks_compiler_options>
  <Program name="C" value="gcc.exe"/>
  <Program name="CPP" value="g++.exe"/>
  <Program name="LD" value="g++.exe"/>
  <Program name="DBGconfig" value="gdb_debugger:Default"/>
  <Program name="LIB" value="ar.exe"/>
  <Program name="WINDRES" value="windres.exe"/>
  <Program name="MAKE" value="mingw32-make.exe"/>
  <Switch name="includeDirs" value="-I"/>
  <Switch name="libDirs" value="-L"/>
  <Switch name="linkLibs" value="-l"/>
  <Switch name="defines" value="-D"/>
  <Switch name="genericSwitch" value="-"/>
  <Switch name="objectExtension" value="o"/>
  <Switch name="forceFwdSlashes" value="false"/>
  <Switch name="forceLinkerUseQuotes" value="false"/>
  <Switch name="forceCompilerUseQuotes" value="false"/>
  <Switch name="needDependencies" value="true"/>
  <Switch name="logging" value="default"/>
  <Switch name="libPrefix" value="lib"/>
  <Switch name="libExtension" value="a"/>
  <Switch name="linkerNeedsLibPrefix" value="false"/>
  <Switch name="linkerNeedsLibExtension" value="false"/>
  <Switch name="linkerNeedsPathResolved" value="false"/>
  <Switch name="supportsPCH" value="true"/>
  <Switch name="PCHExtension" value="gch"/>
  <Switch name="UseFlatObjects" value="false"/>
  <Switch name="UseFullSourcePaths" value="true"/>
  <Switch name="includeDirSeparator" value=" "/>
  <Switch name="libDirSeparator" value=" "/>
  <Switch name="objectSeparator" value=" "/>
  <Switch name="statusSuccess" value="0"/>
  <Switch name="Use83Paths" value="false"/>
  <Command name="CompileObject" value="$compiler $options $includes -c $file -o $object"/>
  <Command name="CompileObject" value="swig -c++ -lua $includes -o $file_dir/$file_name.cpp $file" ext="i" gen="$file_dir/$file_name.cpp"/>
  <Command name="CompileObject" value="ragel $file -C -L -o $file.cpp" ext="rl" gen="$file.cpp"/>
  <Command name="CompileObject" value="bison -v -d $file -o $file_dir/$file_name.parser.cc" ext="y" gen="$file_dir/$file_name.parser.cc;$file_dir/$file_name.parser.hh"/>
  <Command name="CompileObject" value="flex -o$file_dir/$file_name.scanner.cc $file" ext="l" gen="$file_dir/$file_name.scanner.cc"/>
  <Command name="CompileObject" value="cython $file" ext="pyx" gen="$file_dir/$file_name.c"/>
  <Command name="CompileObject" value="lzz $includes $file" ext="lzz" gen="$file_dir/$file_name.cpp;$file_dir/$file_name.h"/>
  <Command name="GenDependencies" value="$compiler -MM $options -MF $dep_object -MT $object $includes $file"/>
  <Command name="CompileResource" value="$rescomp $res_includes -J rc -O coff -i $file -o $resource_output"/>
  <Command name="LinkExe" value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs -mwindows"/>
  <Command name="LinkConsoleExe" value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs"/>
  <Command name="LinkDynamic" value="$linker -shared -Wl,--output-def=$def_output -Wl,--out-implib=$static_output -Wl,--dll $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs"/>
  <Command name="LinkStatic" value="cmd /c if exist $static_output del $static_output&#xA;$lib_linker -r -s $static_output $link_objects"/>
  <Command name="LinkNative" value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs -Wl,--subsystem,native"/>
  <RegEx name="Fatal error" type="error" msg="1">
    <![CDATA[FATAL:[ \t]*(.*)]]>
  </RegEx>
  <RegEx name="'In function...' info" type="info" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):[ \t]+([iI]n ([cC]lass|[cC]onstructor|[dD]estructor|[fF]unction|[mM]ember [fF]unction).*)]]>
  </RegEx>
  <RegEx name="'Skipping N instantiation contexts' info (2)" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]+(\[[ \t]+[Ss]kipping [0-9]+ instantiation contexts[ \t]+\])]]>
  </RegEx>
  <RegEx name="'Skipping N instantiation contexts' info" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t]+(\[[ \t]+[Ss]kipping [0-9]+ instantiation contexts[ \t]+\])]]>
  </RegEx>
  <RegEx name="'In instantiation' warning" type="warning" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):[ \t]+([Ii]n [Ii]nstantiation.*)]]>
  </RegEx>
  <RegEx name="'Required from' warning" type="warning" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]+([Rr]equired from.*)]]>
  </RegEx>
  <RegEx name="'Instantiated from' info (2)" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]+([Ii]nstantiated from .*)]]>
  </RegEx>
  <RegEx name="'Instantiated from' info" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t]+([Ii]nstantiated from .*)]]>
  </RegEx>
  <RegEx name="Resource compiler error" type="error" msg="3" file="1" line="2">
    <![CDATA[windres.exe:[ \t]([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t](.*)]]>
  </RegEx>
  <RegEx name="Resource compiler error (2)" type="error" msg="1">
    <![CDATA[windres.exe:[ \t](.*)]]>
  </RegEx>
  <RegEx name="Preprocessor warning" type="warning" msg="4" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):([0-9]+):[ \t]([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Compiler note (2)" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]([Nn]ote:[ \t].*)]]>
  </RegEx>
  <RegEx name="Compiler note" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t]([Nn]ote:[ \t].*)]]>
  </RegEx>
  <RegEx name="General note" type="info" msg="1">
    <![CDATA[([Nn]ote:[ \t].*)]]>
  </RegEx>
  <RegEx name="Preprocessor error" type="error" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t](.*)]]>
  </RegEx>
  <RegEx name="Compiler warning (2)" type="warning" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Compiler warning" type="warning" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t]([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Undefined reference (2)" type="error" msg="3" file="1" line="2">
    <![CDATA[[][{}() \t#%$~[:alnum:]&_:+/\.-]+\.o:([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t](undefined reference.*)]]>
  </RegEx>
  <RegEx name="Compiler error (2)" type="error" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t](.*)]]>
  </RegEx>
  <RegEx name="Compiler error" type="error" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t](.*)]]>
  </RegEx>
  <RegEx name="Linker warning" type="warning" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):\(\.text\+[0-9a-fA-FxX]+\):[ \t]([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Linker error" type="error" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t](.*)]]>
  </RegEx>
  <RegEx name="Linker error (2)" type="error" msg="2" file="1">
    <![CDATA[[][{}() \t#%$~[:alnum:]&_:+/\.-]+\(.text\+[0-9A-Za-z]+\):([ \tA-Za-z0-9_:+/\.-]+):[ \t](.*)]]>
  </RegEx>
  <RegEx name="Linker error (3)" type="error" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):\(\.text\+[0-9a-fA-FxX]+\):(.*)]]>
  </RegEx>
  <RegEx name="Linker error (lib not found)" type="error" msg="2" file="1">
    <![CDATA[.*(ld.*):[ \t](cannot find.*)]]>
  </RegEx>
  <RegEx name="Linker error (cannot open output file)" type="error" msg="2;3" file="1">
    <![CDATA[.*(ld.*):[ \t](cannot open output file.*):[ \t](.*)]]>
  </RegEx>
  <RegEx name="Linker error (unrecognized option)" type="error" msg="2" file="1">
    <![CDATA[.*(ld.*):[ \t](unrecognized option.*)]]>
  </RegEx>
  <RegEx name="Compiler error (unrecognized option)" type="error" msg="1">
    <![CDATA[.*cc.*:[ \t]([Uu]nrecognized.*option.*)]]>
  </RegEx>
  <RegEx name="No such file or directory" type="error" msg="2" file="1">
    <![CDATA[.*:(.*):[ \t](No such file or directory.*)]]>
  </RegEx>
  <RegEx name="Undefined reference" type="error" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):[ \t](undefined reference.*)]]>
  </RegEx>
  <RegEx name="General error" type="error" msg="1">
    <![CDATA[([Ee]rror:[ \t].*)]]>
  </RegEx>
  <RegEx name="General warning" type="warning" msg="1">
    <![CDATA[([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Auto-import info" type="info" msg="1">
    <![CDATA[([Ii]nfo:[ \t].*)\(auto-import\)]]>
  </RegEx>
  <RegEx name="Linker warning (different sized sections)" type="warning" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):[ \t]+(duplicate section.*has different size)]]>
  </RegEx>
  <Sort CFlags="-std=c90 -std=c89 -std=iso9899:1990 -std=iso9899:199409 -std=c99 -std=c9x -std=iso9899:1999 -std=iso9899:199x -std=c11 -std=c1x -std=iso9899:2011 -std=gnu90 -std=gnu89 -std=gnu99 -std=gnu9x -std=gnu11 -std=gnu1x"/>
  <Sort CPPFlags="-std=c++98 -std=c++03 -std=gnu++98 -std=gnu++03 -std=c++11 -std=c++0x -std=gnu++11 -std=gnu++0x -std=c++1y -std=gnu++1y -static-libstdc++ -shared-libstdc++ -fpermissive -fdeduce-init-list -fcheck-new -fstrict-enums -Weffc++ -Wctor-dtor-privacy -Wdelete-non-virtual-dtor -Wliteral-suffix -Wc++11-compat -Wnoexcept -Wnon-virtual-dtor -Wreorder -Wstrict-null-sentinel -Wno-non-template-friend -Wnon-template-friend -Wold-style-cast -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo"/>
</CodeBlocks_compiler_options>

No more XML's there.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Lost compiler flags in Build options.
« Reply #3 on: April 23, 2014, 04:16:43 pm »
Your XML file was somehow generated without <Option [...] /> entries (??!! - this is a bug, if you can remember/figure out steps to reproduce, please post).  Deleting/(re)moving  this file (which is a local configuration) will restore the default flag listing.

Offline Sagaceil

  • Single posting newcomer
  • *
  • Posts: 9
Re: Lost compiler flags in Build options.
« Reply #4 on: April 23, 2014, 04:59:33 pm »
Thanks, deleting this file helped to restore options.

Steps :

Duplicate compiler set (for example GNU GCC to 'copy GNU GCC' ) under Settings -> Compiler window.
Create some project using that 'copy GNU GCC'.

// here I bought new laptop and installed C::B w/o that 'copy GNU GCC' and moved all files of project to new machine. It might be reinstalled and installed C::B, should give the same behavior - delete 'copy GNU..'

Try to open project, go to Build options.
Then I got message, that chosen compiler doesn't exists, so I'm selecting regular GNU GCC. <-- here I lost all options.

These steps to reproduce it are quite rare so most users doesn't even feel that bug ;)

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: Lost compiler flags in Build options.
« Reply #5 on: March 27, 2016, 07:17:15 pm »
Interestingly I observed the same using V15.12 on Win7:
  The GCC "compiler flags" and the "Linker settings" tabs are empty.

On a second PC is the same C::B version with the same default.conf file. There all is fine.

In no profile is any *.xml file.

The flags also disappeard from two compiler setting I made from copies with other gcc versions.
VC compiler flags are all OK.

I compared the profile and Installation folders on both PCs with no relevant differences.  Running
V16.01 had the same result. In the default.conf I could not see any hint from where C::B is taking
the information for the flags Tab. Looking through this post and searching the forum I found no
other clues. I am a bit out of ideas right now...
 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Lost compiler flags in Build options.
« Reply #6 on: March 27, 2016, 08:50:13 pm »
The flags are in xml files. The default ones are where you've installed cb and the modified ones are in some subfolder of the folder where the default.conf file is (most probably %APPDATA%/codeblocks/...).
(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!]

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: Lost compiler flags in Build options.
« Reply #7 on: March 27, 2016, 09:31:54 pm »
Great, thanks!
I found the default XMLs.  it helped to better understand how the sytem works.
Also I found in one of the profile subfolders of the profile the mentioned XML file.

It was in <proflile>Codeblocks/shared/codeblocks/compiler/*.xml.
After deleting that file the Flags were back. Stupid me that this did not show up in my Diff... :-[



Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Lost compiler flags in Build options.
« Reply #8 on: March 29, 2016, 05:41:37 am »
After deleting that file the Flags were back. Stupid me that this did not show up in my Diff... :-[
Please use C::B to edit these files through the compiler settings (right click in the settings dialog on an option).
We don't guarantee that it works if you do it by hand. If you do so, you are on your own and might crash C::B.
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 gd_on

  • Lives here!
  • ****
  • Posts: 796
Re: Lost compiler flags in Build options.
« Reply #9 on: March 29, 2016, 09:50:09 am »
Quote
Please use C::B to edit these files through the compiler settings (right click in the settings dialog on an option).
The problem described by "tigerbeard" or "sagaceil" is different. The compiler setting window is empty, so no way to select something.
I had also this problem on gcc compiler, but not on other compilers, and only on one PC, not on others.
As described by oBFuscated, I had an other option_gcc.xml file in my profile (in ... AppData\Roaming\CodeBlocks\share\codeblocks\compilers : I'm on Windows 7). The content of that file was very different of the normal one in my Program Files folder. Certainly generating a conflict and I don't know how the modified file was created (I never edited that xml file manually).
A solution is effectively to delete this modified file and the gcc option window appears again normally.

gd_on
« Last Edit: March 29, 2016, 10:10:53 am by gd_on »
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline pabristow

  • Multiple posting newcomer
  • *
  • Posts: 75
Re: Lost compiler flags in Build options.
« Reply #10 on: February 08, 2018, 04:22:26 pm »
I have a similar problem.

When I click on the any GCC version Build options, Compiler tab, no screen of options appears :-(

I note that %APPDATA%/codeblocks/ I have two files

"C:\Users\Paul\AppData\Roaming\CodeBlocks\share\codeblocks\compilers\options_gcc.xml" 10 kB and

"C:\Users\Paul\AppData\Roaming\CodeBlocks\share\codeblocks\compilers\options_gnu_gcc_611_compiler.xml" 20 kB

Looks like something is lost from the options_gcc.xml

I have tried renaming or deleting either or both of these with no good results (missing compiler info boxes are startup).

so I tried renaming the bigger one to options.gcc-xml and that provides the options screen.
However when compiling using a GCC compiler, I now get a message -Weverything is not a know option.

Since this has come from options_clang.xml, no options_gcc.xml I've obviously got more than one thing scrambled :-(

Please can you suggest how to get working again.

Upgrade to 17?  (I am using the latest compiler version Clang 5 (or 6) and GCC 7.2.0).

Thanks

Paul




 


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Lost compiler flags in Build options.
« Reply #11 on: February 08, 2018, 05:27:14 pm »
i have the same issue, and try to fix this for quite some time.
EDIT: Deleting the xxxx_gcc.xml from the AppData/Roaming/Codeblocks/shared/codeblocks folder did the thing...

I have also the problem, that the compiler selection dialogue shows up every time i start codeblocks. I think some config file is broken, but i can not figure out where this dialog is called...

Any hint where to start to debug? Is the default compiler selection dialog part of the compiler plugin or the main application?
« Last Edit: February 08, 2018, 05:30:00 pm by BlueHazzard »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Lost compiler flags in Build options.
« Reply #12 on: February 08, 2018, 06:38:56 pm »
Any hint where to start to debug? Is the default compiler selection dialog part of the compiler plugin or the main application?
The compiler plugin. Search for the dialog name. Then you'll find the xrc file. There you'll see the id of the dialog and then searching by this id you could find where the dialog is created.
The other options is to start C::B under a debugger and break when the dialog is shown. If you inspect the callstack you'll see the place where the dialog has been shown.
(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!]

Offline vid512

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: Lost compiler flags in Build options.
« Reply #13 on: March 20, 2020, 08:57:53 pm »
This has just happened to me with C::B nighly, on Debian 10 (buster).
Quote
Name             : Code::Blocks
Version          : svn-r11979
SDK Version      : 1.47.0
Scintilla Version: 3.7.5
Author           : The Code::Blocks Team
E-mail           : info@codeblocks.org
Website          : http://www.codeblocks.org

wxWidgets Library (wxGTK port)
Version 3.0.4 (Unicode: wchar_t, debug level: 1),
Runtime version of toolkit used is 2.24.
Compile-time GTK+ version is 2.24.32.

In "Project build options", the "Compiler flags" is now empty for "GNU GCC Compiler". For all other compilers it displays options normally. This has happened recently. Restarting C::B doesn't help.

As described previously, deleting the "~/.local/share/codeblocks/compilers/options_gcc.xml" solves this problem.

However, I am sure I haven't created this file manually. It must have been the Code::Blocks itself. Prior to this happening, I have been fiddling around a lot with Project build options, and restarting C::B often, something there must have triggered this. I might have accidentally switched compiler to something else and then back to GCC.

Contents of /usr/share/codeblocks/compilers/options_gcc.xml:
Code
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_compiler_options>
<CodeBlocks_compiler_options>
    <if platform="windows">
        <Program name="C"         value="mingw32-gcc.exe"/>
        <Program name="CPP"       value="mingw32-g++.exe"/>
        <Program name="LD"        value="mingw32-g++.exe"/>
        <Program name="DBGconfig" value="gdb_debugger:Default"/>
        <Program name="LIB"       value="ar.exe"/>
        <Program name="WINDRES"   value="windres.exe"/>
        <Program name="MAKE"      value="mingw32-make.exe"/>
    </if>
    <else>
        <Program name="C"         value="gcc"/>
        <Program name="CPP"       value="g++"/>
        <Program name="LD"        value="g++"/>
        <Program name="DBGconfig" value="gdb_debugger:Default"/>
        <Program name="LIB"       value="ar"/>
        <Program name="WINDRES"   value=""/>
        <Program name="MAKE"      value="make"/>
    </else>

    <Switch name="includeDirs"             value="-I"/>
    <Switch name="libDirs"                 value="-L"/>
    <Switch name="linkLibs"                value="-l"/>
    <Switch name="defines"                 value="-D"/>
    <Switch name="genericSwitch"           value="-"/>
    <Switch name="objectExtension"         value="o"/>
    <Switch name="needDependencies"        value="true"/>
    <Switch name="forceCompilerUseQuotes"  value="false"/>
    <Switch name="forceLinkerUseQuotes"    value="false"/>
    <Switch name="logging"                 value="default"/>
    <Switch name="libPrefix"               value="lib"/>
    <Switch name="libExtension"            value="a"/>
    <Switch name="linkerNeedsLibPrefix"    value="false"/>
    <Switch name="linkerNeedsLibExtension" value="false"/>
    <Switch name="supportsPCH"             value="true"/>
    <Switch name="PCHExtension"            value="gch"/>
    <Switch name="UseFullSourcePaths"      value="true"/>

    <!-- Summary of GCC options: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html -->

    <Option name="Produce debugging symbols"
            option="-g"
            category="Debugging"
            checkAgainst="-O -O1 -O2 -O3 -Os"
            checkMessage="You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."
            supersedes="-s"/>
    <Option name="Optimize debugging executable (compile speed, execution speed and better debugging)"
            option="-Og"
            category="Debugging"
            supersedes="-O -O1 -O2 -O3"/>
    <Option name="Target x86 (32bit)"
            option="-m32"
            additionalLibs="-m32"
            supersedes="-m64"/>
    <Option name="Target x86_64 (64bit)"
            option="-m64"
            additionalLibs="-m64"
            supersedes="-m32"/>
    <Option name="Position Independent Code"
            option="-fPIC"/>
    <Option name="Static linking"
            additionalLibs="-static"/>
    <Option name="Static libgcc"
            additionalLibs="-static-libgcc"/>
    <Option name="Static libstdc++"
            additionalLibs="-static-libstdc++"/>
    <if platform="windows">
        <Option name="Profile code when executed"
                option="-pg"
                category="Profiling"
                additionalLibs="-pg -lgmon"
                supersedes="-s"/>
    </if>
    <else>
        <Option name="Profile code when executed"
                option="-pg"
                category="Profiling"
                additionalLibs="-pg"
                supersedes="-s"/>
    </else>

    <!-- warnings -->
    <Common name="warnings"/>
    <Category name="Warnings">
        <Option name="Enable Effective-C++ warnings (thanks Scott Meyers)"
                option="-Weffc++"/>
        <Option name="Warn whenever a switch statement does not have a default case"
                option="-Wswitch-default"/>
        <Option name="Warn whenever a switch statement has an index of enumerated type and lacks a case for one or more of the named codes of that enumeration"
                option="-Wswitch-enum"/>
        <if exec="C -dumpversion"
            regex="^[4-9]"
            default="true">
            <Option name="Warn if a user supplied include directory does not exist"
                    option="-Wmissing-include-dirs"/>
        </if>
        <Option name="Warn if a global function is defined without a previous declaration"
                option="-Wmissing-declarations"/>
        <Option name="Warn if the compiler detects that code will never be executed"
                option="-Wunreachable-code"/>
        <Option name="Warn if a function can not be inlined and it was declared as inline"
                option="-Winline"/>
        <Option name="Warn if floating point values are used in equality comparisons"
                option="-Wfloat-equal"/>
        <Option name="Warn if an undefined identifier is evaluated in an '#if' directive"
                option="-Wundef"/>
        <Option name="Warn whenever a pointer is cast such that the required alignment of the target is increased"
                option="-Wcast-align"/>
        <Option name="Warn if anything is declared more than once in the same scope"
                option="-Wredundant-decls"/>
        <Option name="Warn about unitialized variables which are initialized with themselves"
                option="-Winit-self"/>
        <Option name="Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed"
                option="-Wshadow"/>
        <Option name="Warn if a class has virtual functions but no virtual destructor"
                option="-Wnon-virtual-dtor"/>
    </Category>

    <!-- optimization -->
    <Common name="optimization"/>
    <Option name="Don't keep the frame pointer in a register for functions that don't need one"
            option="-fomit-frame-pointer"
            category="Optimization"
            checkAgainst="-g -ggdb"
            checkMessage="You have debugging symbols enabled. This is Not A Good Thing(tm) when optimizing..."/>

    <!-- machine dependent options - cpu arch -->
    <Common name="architecture"/>

    <Command name="CompileObject"
             value="$compiler $options $includes -c $file -o $object"/>
    <Command name="GenDependencies"
             value="$compiler -MM $options -MF $dep_object -MT $object $includes $file"/>
    <Command name="CompileResource"
             value="$rescomp $res_includes $res_options -J rc -O coff -i $file -o $resource_output"/>
    <Command name="LinkConsoleExe"
             value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs"/>
    <if platform="windows">
        <Command name="LinkNative"
                 value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs -Wl,--subsystem,native"/>
        <Command name="LinkExe"
                 value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs -mwindows"/>
        <Command name="LinkDynamic"
                 value="$linker -shared -Wl,--output-def=$def_output -Wl,--out-implib=$static_output -Wl,--dll $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs"/>
        <Command name="LinkStatic"
                 value="cmd /c if exist $static_output del $static_output\n$lib_linker -r -s $static_output $link_objects"/>
    </if>
    <else>
        <Command name="LinkNative"
                 value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs"/>
        <Command name="LinkExe"
                 value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs"/>
        <Command name="LinkDynamic"
                 value="$linker -shared $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs"/>
        <Command name="LinkStatic"
                 value="rm -f $static_output\n$lib_linker -r -s $static_output $link_objects"/>
    </else>
    <Common name="cmds"/>

    <Common name="re"/>

    <Common name="sort"/>
</CodeBlocks_compiler_options>

Contents of ~/.local/share/codeblocks/compilers/options_gcc.xml:
Code
<?xml version="1.0" encoding="UTF-8"?>
<CodeBlocks_compiler_options>
  <Program name="C" value="gcc"/>
  <Program name="CPP" value="g++"/>
  <Program name="LD" value="g++"/>
  <Program name="DBGconfig" value="gdb_debugger:Default"/>
  <Program name="LIB" value="ar"/>
  <Program name="WINDRES" value=""/>
  <Program name="MAKE" value="make"/>
  <Switch name="includeDirs" value="-I"/>
  <Switch name="libDirs" value="-L"/>
  <Switch name="linkLibs" value="-l"/>
  <Switch name="defines" value="-D"/>
  <Switch name="genericSwitch" value="-"/>
  <Switch name="objectExtension" value="o"/>
  <Switch name="forceFwdSlashes" value="false"/>
  <Switch name="forceLinkerUseQuotes" value="false"/>
  <Switch name="forceCompilerUseQuotes" value="false"/>
  <Switch name="needDependencies" value="true"/>
  <Switch name="logging" value="default"/>
  <Switch name="libPrefix" value="lib"/>
  <Switch name="libExtension" value="a"/>
  <Switch name="linkerNeedsLibPrefix" value="false"/>
  <Switch name="linkerNeedsLibExtension" value="false"/>
  <Switch name="linkerNeedsPathResolved" value="false"/>
  <Switch name="supportsPCH" value="true"/>
  <Switch name="PCHExtension" value="gch"/>
  <Switch name="UseFlatObjects" value="false"/>
  <Switch name="UseFullSourcePaths" value="true"/>
  <Switch name="includeDirSeparator" value=" "/>
  <Switch name="libDirSeparator" value=" "/>
  <Switch name="objectSeparator" value=" "/>
  <Switch name="statusSuccess" value="0"/>
  <Switch name="Use83Paths" value="false"/>
  <Command name="CompileObject" value="$compiler $options $includes -c $file -o $object"/>
  <Command name="CompileObject" value="swig -c++ -lua $includes -o $file_dir/$file_name.cpp $file" ext="i" gen="$file_dir/$file_name.cpp"/>
  <Command name="CompileObject" value="ragel $file -C -L -o $file.cpp" ext="rl" gen="$file.cpp"/>
  <Command name="CompileObject" value="bison -v -d $file -o $file_dir/$file_name.parser.cc" ext="y" gen="$file_dir/$file_name.parser.cc;$file_dir/$file_name.parser.hh"/>
  <Command name="CompileObject" value="flex -o$file_dir/$file_name.scanner.cc $file" ext="l" gen="$file_dir/$file_name.scanner.cc"/>
  <Command name="CompileObject" value="cython $file" ext="pyx" gen="$file_dir/$file_name.c"/>
  <Command name="CompileObject" value="lzz $includes $file" ext="lzz" gen="$file_dir/$file_name.cpp;$file_dir/$file_name.h"/>
  <Command name="GenDependencies" value="$compiler -MM $options -MF $dep_object -MT $object $includes $file"/>
  <Command name="CompileResource" value="$rescomp $res_includes $res_options -J rc -O coff -i $file -o $resource_output"/>
  <Command name="LinkExe" value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs"/>
  <Command name="LinkConsoleExe" value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs"/>
  <Command name="LinkDynamic" value="$linker -shared $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs"/>
  <Command name="LinkStatic" value="rm -f $static_output&#xA;$lib_linker -r -s $static_output $link_objects"/>
  <Command name="LinkNative" value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs"/>
  <RegEx name="Fatal error" type="error" msg="1">
    <![CDATA[FATAL:[ \t]*(.*)]]>
  </RegEx>
  <RegEx name="'In function...' info" type="info" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):[ \t]+([iI]n ([cC]lass|[cC]onstructor|[dD]estructor|[fF]unction|[mM]ember [fF]unction).*)]]>
  </RegEx>
  <RegEx name="'Skipping N instantiation contexts' info (2)" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]+(\[[ \t]+[Ss]kipping [0-9]+ instantiation contexts[ \t]+\])]]>
  </RegEx>
  <RegEx name="'Skipping N instantiation contexts' info" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t]+(\[[ \t]+[Ss]kipping [0-9]+ instantiation contexts[ \t]+\])]]>
  </RegEx>
  <RegEx name="'In instantiation' warning" type="warning" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):[ \t]+([Ii]n [Ii]nstantiation.*)]]>
  </RegEx>
  <RegEx name="'Required from' warning" type="warning" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]+([Rr]equired from.*)]]>
  </RegEx>
  <RegEx name="'Instantiated from' info (2)" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]+([Ii]nstantiated from .*)]]>
  </RegEx>
  <RegEx name="'Instantiated from' info" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t]+([Ii]nstantiated from .*)]]>
  </RegEx>
  <RegEx name="Resource compiler error" type="error" msg="3" file="1" line="2">
    <![CDATA[windres.exe:[ \t]([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t](.*)]]>
  </RegEx>
  <RegEx name="Resource compiler error (2)" type="error" msg="1">
    <![CDATA[windres.exe:[ \t](.*)]]>
  </RegEx>
  <RegEx name="Preprocessor warning" type="warning" msg="4" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):([0-9]+):[ \t]([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Compiler note (2)" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]([Nn]ote:[ \t].*)]]>
  </RegEx>
  <RegEx name="Compiler note" type="info" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t]([Nn]ote:[ \t].*)]]>
  </RegEx>
  <RegEx name="General note" type="info" msg="1">
    <![CDATA[([Nn]ote:[ \t].*)]]>
  </RegEx>
  <RegEx name="Preprocessor error" type="error" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t](.*)]]>
  </RegEx>
  <RegEx name="Compiler warning (2)" type="warning" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t]([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Compiler warning" type="warning" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t]([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Undefined reference (2)" type="error" msg="3" file="1" line="2">
    <![CDATA[[][{}() \t#%$~[:alnum:]&_:+/\.-]+\.o:([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t](undefined reference.*)]]>
  </RegEx>
  <RegEx name="Compiler error (2)" type="error" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t](.*)]]>
  </RegEx>
  <RegEx name="Compiler error" type="error" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[ \t](.*)]]>
  </RegEx>
  <RegEx name="Linker warning" type="warning" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):\(\.text\+[0-9a-fA-FxX]+\):[ \t]([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Linker error" type="error" msg="3" file="1" line="2">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+):[0-9]+:[ \t](.*)]]>
  </RegEx>
  <RegEx name="Linker error (2)" type="error" msg="2" file="1">
    <![CDATA[[][{}() \t#%$~[:alnum:]&_:+/\.-]+\(.text\+[0-9A-Za-z]+\):([ \tA-Za-z0-9_:+/\.-]+):[ \t](.*)]]>
  </RegEx>
  <RegEx name="Linker error (3)" type="error" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):\(\.text\+[0-9a-fA-FxX]+\):(.*)]]>
  </RegEx>
  <RegEx name="Linker error (lib not found)" type="error" msg="2" file="1">
    <![CDATA[.*(ld.*):[ \t](cannot find.*)]]>
  </RegEx>
  <RegEx name="Linker error (cannot open output file)" type="error" msg="2;3" file="1">
    <![CDATA[.*(ld.*):[ \t](cannot open output file.*):[ \t](.*)]]>
  </RegEx>
  <RegEx name="Linker error (unrecognized option)" type="error" msg="2" file="1">
    <![CDATA[.*(ld.*):[ \t](unrecognized option.*)]]>
  </RegEx>
  <RegEx name="Compiler error (unrecognized option)" type="error" msg="1">
    <![CDATA[.*cc.*:[ \t]([Uu]nrecognized.*option.*)]]>
  </RegEx>
  <RegEx name="No such file or directory" type="error" msg="2" file="1">
    <![CDATA[.*:(.*):[ \t](No such file or directory.*)]]>
  </RegEx>
  <RegEx name="Undefined reference" type="error" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):[ \t](undefined reference.*)]]>
  </RegEx>
  <RegEx name="General error" type="error" msg="1">
    <![CDATA[([Ee]rror:[ \t].*)]]>
  </RegEx>
  <RegEx name="General warning" type="warning" msg="1">
    <![CDATA[([Ww]arning:[ \t].*)]]>
  </RegEx>
  <RegEx name="Auto-import info" type="info" msg="1">
    <![CDATA[([Ii]nfo:[ \t].*)\(auto-import\)]]>
  </RegEx>
  <RegEx name="Linker warning (different sized sections)" type="warning" msg="2" file="1">
    <![CDATA[([][{}() \t#%$~[:alnum:]&_:+/\.-]+):[ \t]+(duplicate section.*has different size)]]>
  </RegEx>
  <Sort CFlags="-std=c89 -std=gnu89 -std=c90 -std=gnu90 -std=iso9899:1990 -std=iso9899:1994 -std=c99 -std=gnu99 -std=iso9899:1999 -std=c11 -std=gnu11 -std=iso9899:2011 -std=c17 -std=iso9899:2017"/>
  <Sort CPPFlags="-std=c++98 -std=gnu++98 -std=c++03 -std=gnu++03 -std=c++11 -std=gnu++11 -std=c++14 -std=gnu++14 -std=c++17 -std=gnu++17 -std=c++20 -std=gnu++20 -static-libstdc++ -shared-libstdc++ -fpermissive -fdeduce-init-list -fcheck-new -fstrict-enums -Weffc++ -Wctor-dtor-privacy -Wdelete-non-virtual-dtor -Wliteral-suffix -Wc++11-compat -Wnoexcept -Wnon-virtual-dtor -Wreorder -Wstrict-null-sentinel -Wno-non-template-friend -Wnon-template-friend -Wold-style-cast -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo -fno-rtti -fno-threadsafe-statics"/>
</CodeBlocks_compiler_options>

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Lost compiler flags in Build options.
« Reply #14 on: March 21, 2020, 01:03:01 am »
This might fix your problem.

Warning: If you have done any customization of the Compiler setting they will be lost.
(This has nothing to do with Project settings that were done.)

Settings -> Compiler
Pull down: "Selected Compiler" select compiler/toolchain that needs fixed
Click on tab "Compiler Flags"

If the flags are missing from here than the problem may be fixed by clicking on "Reset Defaults" by where you selected the compiler.

If the flags are listed here you likely selected the wrong compiler in the CB project.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org