Same command line every time:
Switching to target: default
mingw32-g++.exe -Os -O -march=i686 -IC:\MinGW\include -IC:\MinGW\include\wx -IC:\MinGW\include\codeblocks -IC:\MinGW\include\wx\msw -c main.cpp -o .objs\main.o
mingw32-g++.exe -LC:\CodeBlocks\lib -LC:\CodeBlocks -LC:\MinGW\lib -o D:\repos\d\console.exe .objs\main.o -luuid -lwsock32 -lole32 -lgdi32 -lkernel32 -luser32
Same command line every time:
can you please try to add to "Other options"
after you have removed all compiler switches
1) when i try this after i've removed all switches, it compiles with
Project : Console application
Compiler : GNU GCC Compiler (called directly)
Directory : D:\cpp\_projects\CodeBlocks\TESTS\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-gcc.exe -c main.c -o .objs\main.o
mingw32-g++.exe -o D:\cpp\_projects\CodeBlocks\TESTS\test_options.exe .objs\main.o
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
2) then i add to "Other optios"
and result is same as above
3) then check within "Compiler Flags"
x Optimize more (for speed)
x Optimize generated code (for size)
and now the two switches -Os and -O1 are got added
Project : Console application
Compiler : GNU GCC Compiler (called directly)
Directory : D:\cpp\_projects\CodeBlocks\TESTS\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-gcc.exe -Os -O1 -c main.c -o .objs\main.o
mingw32-g++.exe -o D:\cpp\_projects\CodeBlocks\TESTS\test_options.exe .objs\main.o
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
i can't believe that CB behaves in an other way by you,
i checked the code in
src\plugins\compilergcc\compileroptionsdlg.cpp
void CompilerOptionsDlg::OptionsToText()
and it didn't change from RC1 to HEAD (3.8.05)
thanks
Ah, I think I found the cause.
You wrote your switches line by line:
-Os
-O1
I wrote them like I would do on the commandline:
-Os -O1
(did use -O instead of -O1 the first time, but it matters not, same result).
The line break in between seems insignificant, but that is what makes the difference, the former strips off *everything* whether you enable checkboxes or not, and the latter runs as:
Switching to target: default
mingw32-g++.exe -Os -O1 -Os -O1 -D__GNUWIN32__ -DWXUSINGDLL -DBUILDING_PLUGIN -IC:\MinGW\include -IC:\MinGW\include\codeblocks -IC:\MinGW\include\wx -IC:\MinGW\include\tinyxml -IC:\MinGW\include\GL -c main.cpp -o .objs\main.o
mingw32-g++.exe -LC:\CodeBlocks -LC:\CodeBlocks\lib -o D:\Desktop\asasaas\console.exe .objs\main.o -s -lcodeblocks -lwxmsw242 -lcodeblocks -lwxmsw242
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
CompilerOptionsDlg::DoGetCompileOptions() in plugins\compilergcc\compileroptionsdlg.cpp does a lot of work to break the textcontrol's contents into a wxArrayString. Does not make sense to me personally, but there is certainly a good reasoning for that (is array.Clear(); intentional?).
If it were me, I would not care to do such an awful lot with manual options, instead I would do something like this:
compileroptions = DoGetAllCheckBoxOptionsFirst();
tmp = extraOptionsControl->GetValue();
tmp.Replace("\n", " ");
tmp.Replace("\r", " ");
tmp = " " + tmp + " ";
compileroptions.Add(tmp);
That way, the user could use the checkboxes as he likes and can add anything that supersedes these settings under "additional options". Everything is passed as one single option, but the compiler does not know, anyway :)