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 CFLAGS, LDFLAGS, ASFLAGS 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
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).
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).