clashes between global options and projects options
f.e
g++.exe -Wall -fexceptions -std=c++1z -m64 -g -Wnon-virtual-dtor -Wshadow -Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Wunreachable-code -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Wmain -pedantic-errors -pedantic -Wextra -Wall -std=c++14 -Og -g -IC:\msys64\mingw64\include -IE:\Cpp\Projects\Headers -c E:\Cpp\Projects\Gz\main.cpp -o obj\Debug\main.o
global option is -std=c++14 but project's is -std=c++1z
accepted behaviour: project's options should overwrite global ones
Greetings
What version are you using? What is the value of the policy in the compiler option in the build options dialog?
using 17.12
as I Already said:
global option is -std=c++14 but project's is -std=c++1z
under the compiler option in the build dialog -- global and project respectively
Are you using the "Compiler flags" or "Other compiler options"?
I think I have the same problem.
A very simple test program (main.cpp plus a testClass.cpp and .h) has some compiler options set (e.g. -g and -m32);
in [project]/Properties/Project's build options.../Compiler settings (for both Debug/Release targets);
option "Policy" is "Use project options only" (for both compiler and linker).
However, when compiling, these settings are completely ignored and the general compiler settings are used regardless:
As per the compile log, the compiler matches the setting in Settings/Compiler.../Selected compiler and compilation succeeds; changing compilation options there also works.
How can I set project-specific option overrides?
This ticket seems to have gone stale since 2018. Is it possible that nobody noticed this blatant issue since?
Can you post a sample project?
For me project options are applied, i mean codeblocks it self would not compile it this wont work...
Last edit: bluehazzard 2023-03-19
Thanks for the quick feedback!
I just installed a fresh copy of CB on a machine at home, to put together a sample project (with the same project files I have on my work machine) and it actually seems to work correctly!
Tomorrow I'll try again on my work machine and try to find what's different; seems more like a config issue now.
Some time ago I remember I had to cleanup the config files because the flag pane was completely empty; don't know it this can be related, I'll make some tests.
Last edit: GiorgioCC 2023-03-19
If the missing compiler flags are returning, please zip the config file and post it in a ticket or in the forum. I am on the hunt of this bug... But i was no longer able to reproduce it...
Just to make things clear:
Global compiler options are ALWAYS applied. There is no overriding of related compiler options. Global options are always applied and no compatibility check is done.
But then it also raises another question: the "Use project options only" option naming in "Policies" is deceptive...
Last edit: GiorgioCC 2023-03-19
"Use project options only" refers to target and project and not global. It is a bit misleading i give you that ;)