Jump to content

2.x compilation error


vrollei

Recommended Posts

Hi!

Get compilation error:

In file included from ugfx_2.8/src/ginput/ginput_driver_mouse.h:23:0,

                 from main.cpp:37:

ugfx_2.8/src/ginput/../gdriver/gdriver.h:91:33: error: duplicate 'const'

typedef const struct GDriverVMT const GDriverVMTList[1];

 

 

gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major)
-std=c11

 

Edited by vrollei
Link to comment
Share on other sites

Joel,

do you mean this:

 

That language construct is perfectly valid C but some compilers incorrectly generate warnings for it.  This is actually a compiler bug caused by a misinterpretation of the C standard by the compiler writer. The most commonly known compiler with this bug is GCC.

It looks like your compiler does one worse - it actually errors on it. Are you sure you just haven't set your compiler flags to error on all warnings?

If not please send us the details of what compiler you are using so that we can put a special #ifdef around the code to account for its brokenness. I think the gfxconf option is something like GFX_OS_COMPILER_SHOW but check the gfxconf.example.h

Link to comment
Share on other sites

Yes, that is the one. In this case as it seems your compiler is gcc based you will need to change the compiler options/flags so it treats it as a warning not an error.

The other thing I noticed is that you seem to be compiling main.cpp when the error occurs. Note you cannot include the gfx source into a cpp file as gfx requires a C compiler not a C++ compiler. The .h files can be included however because they are suitably wrapped to make them C++ compatible. 

Link to comment
Share on other sites

Hi,

You are right it is c++ related error, it is error not warning.

About gcc warnings:

warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]

Is it possible to add this and solve these all warnings:

#if defined(__GNUC__)

#pragma GCC diagnostic ignored "-Wduplicate-decl-specifier"

#endif

 

 

Link to comment
Share on other sites

I won't be changing this double const currently because...

  1. It is valid C syntax and to remove the double const is actually ambiguous,
  2. GCC only produces a warning (except when someone has their flags set to nasty),
  3. If you really want to make it go away in GCC you can add that pragma to your gfxconf.h,
  4. It is all going away shortly in V3 as the way the structure is being stored will be changed, and
  5. I am stubborn :D
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...