Error in DECLARE_CREATE_FROM_STREAM after editing GUI.h

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Error in DECLARE_CREATE_FROM_STREAM after editing GUI.h

      Dear Segger Team,

      I have edited some color definitions in GUI.h. After recompilation I am now getting errors in an unexpected location.

      The 24 lines under

      #define DECLARE_CREATE_FROM_STREAM(ID) int GUI_CreateBitmapFromStream##ID(GUI_BITMAP * pBMP, GUI_LOGPALETTE * pPAL, const void * p);

      are replaced by

      const void

      which produces a declaration error.
      If I uncomment this whole section the compiliation runs normally.
      I am not sure, however, what caused this problem after many years without it.
      I am using STM32CubeIDE 1.9.0.

      Best regards
      Jan
    • Hi,

      By color definitions you mean the default color defines like GUI_BLUE, GUI_WHITE, and so on? I don't understand how changing these defines would have an impact on the macro that declares the streamed bitmap prototypes.

      At any rate, it is not a good idea to modify the emWin source code that we ship. This can make it impossible for us to comprehend any issues that might occur.

      I would suggest that you add your custom color definitions to your own header files. To create custom colors you can use the GUI_MAKE_COLOR() define which will make sure the color bits are swapped correctly in both ABGR and ARGB mode.

      Best regards,
      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi Florian,
      I also don't believe that changing some color values caused the issue. The changes probably just triggered the recompilation of GUI.h. I replaced the file with the original unchanged GUI.h. Even then I get the same problem. It only runs when I uncomment all lines with DECLARE_CREATE_FROM_STREAM.


      Regards
      Jan
    • Hi Jan,

      I doubt that the tokenization feature (## in defines) is not supported by your compiler, we use a lot of different compilers to test our code and we never ran into any problems with this. Which compiler are you using?

      Best regards,
      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi Jan,

      I believe STM32CubeIDE uses the GCC compiler. Does the compiler output build errors regarding this? Could you send me the errors that are output in your IDE's console window?

      Thanks and best regards,
      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hello Florian,

      yes its GCC based. I was asking about "##" because this is the only place in my project where it occurs.

      There is not much of an error shown. See attached screenshot with the faulty lines and the error messages.

      Regards
      Jan
      Images
      • error.JPG

        121.52 kB, 782×952, viewed 238 times
    • Hi Jan,

      This is odd indeed. Also, these are by far not the only lines in the emWin code where the ## is used in defines. So it cannot be the ## alone what causes this.

      But my guess is that the issue is caused by the IDE, so I would ask ST about this, maybe they already know about this issue.

      Best regards,
      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.