cancel
Showing results for 
Search instead for 
Did you mean: 

TouchgGFX simulator: change compiler setting for .c?

awiernie
Senior II

I use a module which uses C instead of C++.

There is a feature used, which is available in C 99 but not in C++ before C++20.

It can be compiled for the target but compiling the simulator fails with the message below. I could remove the "-pedantic" once in the temporary Makefile in the build directory of the simulator (TouchGFX/generated/simulator/gcc/Makefile):

c_compiler_options_local  += -pedantic $(addprefix -W,$(WARN))

Shouldn't a C file compiled with the C compiler instead of the C++ compiler? The error message says "C++ does not allow...".

if I add "-std=c99" in TouchGFX/config/gcc/app.mk to:

# Optional additional compiler flags

user_cflags := -DUSE_BPP=16 -std=c99

... then I get the following:

 cc1plus.exe: error: command line option '-std=c99' is valid for C/ObjC but not for C++ [-Werror]

Again, why g++ is used instead of gcc for C files?

c_compiler      := g++

c_compiler_options  += -DSIMULATOR='' -g

cpp_compiler     := g++

cpp_compiler_options += -g -DSIMULATOR='' -DENABLE_LOG

"Compiling ../awiemidevice/src/awiemi_conversion.c

    ../awiemidevice/src/awiemi_conversion.c:173:1: error: ISO C++ does not allow C99 designated initializers [-Werror=pedantic]

     {"

The code causing this is:

const struct ModelParam ch4QuotToPpm =

{

.modelName = MODELNAME_RATIONAL,

.a = -2.61246114389584,

...

0 REPLIES 0