Menu

#600 Project's options not overwriting Global ones

Next_Nightly
open
nobody
None
Undefined
2023-03-19
2018-01-15
Arjun Gupta
No

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

Discussion

  • Teodor Petrov

    Teodor Petrov - 2018-01-16

    What version are you using? What is the value of the policy in the compiler option in the build options dialog?

     
  • Arjun Gupta

    Arjun Gupta - 2018-01-17

    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

     
  • bluehazzard

    bluehazzard - 2018-01-17

    Are you using the "Compiler flags" or "Other compiler options"?

     
  • GiorgioCC

    GiorgioCC - 2023-03-18

    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:

    -------------- Build: Debug in testAssign-MinGW32 (compiler: GNU GCC Compiler)---------------
    
    mingw32-g++.exe   -c D:\CTest\testAssign\src\main.cpp -o build\obj\Debug\src\main.o
    mingw32-g++.exe   -c D:\CTest\testAssign\src\TermID.cpp -o build\obj\Debug\src\TermID.o
    mingw32-g++.exe  -o build\bin\Debug\testAssign.exe build\obj\Debug\src\main.o build\obj\Debug\src\TermID.o   
    Output file is build\bin\Debug\testAssign.exe with size 47.12 KB
    Process terminated with status 0 (0 minute(s), 0 second(s))
    0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
    

    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?

     
  • bluehazzard

    bluehazzard - 2023-03-19

    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
    • GiorgioCC

      GiorgioCC - 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
      • bluehazzard

        bluehazzard - 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...

         
  • bluehazzard

    bluehazzard - 2023-03-19

    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.

     
    • GiorgioCC

      GiorgioCC - 2023-03-19

      But then it also raises another question: the "Use project options only" option naming in "Policies" is deceptive...

       

      Last edit: GiorgioCC 2023-03-19
      • bluehazzard

        bluehazzard - 2023-03-19

        "Use project options only" refers to target and project and not global. It is a bit misleading i give you that ;)

         

Log in to post a comment.