vrollei Posted June 27, 2018 Report Share Posted June 27, 2018 (edited) 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 June 27, 2018 by vrollei Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted June 29, 2018 Report Share Posted June 29, 2018 Hi, If you use the forum search you'll find plenty of information regarding the double const Link to comment Share on other sites More sharing options...
vrollei Posted July 5, 2018 Author Report Share Posted July 5, 2018 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 More sharing options...
inmarket Posted July 5, 2018 Report Share Posted July 5, 2018 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 More sharing options...
vrollei Posted July 7, 2018 Author Report Share Posted July 7, 2018 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 More sharing options...
inmarket Posted July 7, 2018 Report Share Posted July 7, 2018 I won't be changing this double const currently because... It is valid C syntax and to remove the double const is actually ambiguous, GCC only produces a warning (except when someone has their flags set to nasty), If you really want to make it go away in GCC you can add that pragma to your gfxconf.h, It is all going away shortly in V3 as the way the structure is being stored will be changed, and I am stubborn Link to comment Share on other sites More sharing options...
vrollei Posted July 7, 2018 Author Report Share Posted July 7, 2018 Ok, not a problem, if I am only person here who uses gcc and got this warning..... I did not suggest to remove double const...., just make less warning with pragma and gcc... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now