Separate CFLAGS and CXXFLAGS with MSBuild

Sysprogs forums Forums VisualGDB Separate CFLAGS and CXXFLAGS with MSBuild

Tagged: , ,

This topic contains 4 replies, has 3 voices, and was last updated by  UdoEberhardt 2 days, 6 hours ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12513

    bojanpotocnik
    Participant

    Hello,

    I would like to suggest a possibility of separate C++ and C flags configuration or ask how to enable it.

    In the VisualGDB Project Properties -> Embedded Project -> Makefiles flags section there are fields for CFLAGSLDFLAGSASFLAGS and Common flags, which are written to the MCU.xml file on save in the associated fields:

    <em>CFLAGS</em> input field content
    <em>CFLAGS</em> input field content
    <em>LDFLAGS</em> input field content
    <em>ASFLAGS</em> input field content
    <em>Common flags </em>input field content

    CXXFLAGS field can be edited here but it is always overwritten with the content of the CFLAGS field. Is there a possibility to add CXXFLAGS input field to the properties with Same as CFLAGS checkbox (enabled by default)?

    • This topic was modified 1 month, 3 weeks ago by  bojanpotocnik. Reason: Grammar
    #12519

    support
    Keymaster

    Hi,

    Having 2 separate sets of flags would unfortunately overcomplicate the VS property pages for MSBuild projects, so instead we have the same flags, but automatically filter out options like -fno-exceptions and also allow specifying C/C++ standards separately (use the VS project properties for that).

    If you are trying to specify some other option that is only supported on C (or C++) files, let us know and we will add it to the VS property pages for MSBuild projects (unless this is something very rarely used in which case you can simply add a custom target to your project for adding those options similar to RemoveIncompatibleCompilerSwitches).

    #12993

    UdoEberhardt
    Participant

    Hi,

    I do have the same problem and found this thread. I want to use gcc option -fno-use-cxa-atexit which is a very useful one for embedded C++ projects. I added -fno-use-cxa-atexit in project properties under C/C++ – Command Line. The project contains C++ and C files. For C files this option causes a gcc warning:

    gcc command line option ‘-fno-use-cxa-atexit’ is valid for c++/objc++ but not for c

    which cannot be suppressed with another option.

    Is there any chance that you will add this option to the prop page, or filter it out automatically for C files?

    My suggestion is to enhance the C/C++ – Command Line dialog to offer separate options for C and C++. Alternatively, you could support some proprietary syntax to support filtering of options specified under Additional Options, for example: $CPPFLAG(-fno-use-cxa-atexit) $CFLAG(-some-useful-option).

    Udo

     

    #13007

    support
    Keymaster

    Hi,

    OK, please try this build: http://sysprogs.com/files/tmp/VisualGDB-5.3.16.1933.msi

    We have added new options under C/C++->Advanced:

    • Additional Options (C files)
    • Additional Options (C++ files)
    #13015

    UdoEberhardt
    Participant

    Hi,

    This works. Thanks for your great support!

    Udo

     

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.