Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error in plugins/gvar_extended/main.cpp #54

Closed
gvanem opened this issue Oct 26, 2021 · 2 comments
Closed

Compile error in plugins/gvar_extended/main.cpp #54

gvanem opened this issue Oct 26, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@gvanem
Copy link

gvanem commented Oct 26, 2021

Trying to compile the plugins with MSVC-2019, I got this (for me) weird error in plugins/gvar_extended/main.cpp:

f:\gv\VC_2019\VC\Tools\MSVC\14.29.30133\include\vadefs.h(194): error C2338: va_start argument must not have 
reference type and must not be parenthesized
F:\gv\dx-radio\Satellite\SatDump\src-core\CImg.h(48553): note: see reference to class template instantiation 
'__vcrt_assert_va_start_is_not_reference<const cimg_library::CImgList<unsigned char> &>' being compiled
plugins/gvar_extended/main.cpp(132): note: see reference to function template instantiation 
'cimg_library::CImg<unsigned char> &cimg_library::CImg<unsigned char>::draw_text<unsigned char,unsigned char>(const int,const int,const char *const,const tc *const ,const int,const float,const cimg_library::CImgList<unsigned char> &,...)' 
being compiled
        with
        [
            tc=unsigned char
        ]
plugins/gvar_extended/main.cpp(132): note: see reference to function template instantiation 
'cimg_library::CImg<unsigned char> &cimg_library::CImg<unsigned char>::draw_text<unsigned char,unsigned char>(const int,const int,const char *const, const tc *const ,const int,const float,const cimg_library::CImgList<unsigned char> &,...)' 
being compiled with
        [
            tc=unsigned char
        ]

(slightly edited).

Some issue in src-core/CImg.h at line 48553 that MSVC-2019 does not like:

    template<typename tc1, typename tc2, typename t>
    CImg<T>& draw_text(const int x0, const int y0,
                       const char *const text,
                       const tc1 *const foreground_color, const tc2 *const background_color,
                       const float opacity, const CImgList<t>& font, ...) {
      if (!font) return *this;
      CImg<charT> tmp(2048);
      std::va_list ap; va_start(ap,font);  // !! line 48553
      cimg_vsnprintf(tmp,tmp._width,text,ap); va_end(ap);
      return _draw_text(x0,y0,tmp,foreground_color,background_color,opacity,font,false);
    }

Compiling the same file with clang-cl works fine.
I had to add -D_CRT_NO_VA_START_VALIDATION to avoid this error.

@Aang23
Copy link
Collaborator

Aang23 commented Oct 27, 2021

First of all, the code in this plugin is considered very WIP (and you may notice it really is not very clean as of now), though about this specific bug, it's something I would personally blame on CImg, and report the issue there instead.

MSVC will complain about a similar issue in src-core/common/map/map_drawer.cpp

@Aang23 Aang23 added the bug Something isn't working label Oct 27, 2021
@ZbychuButItWasTaken
Copy link
Collaborator

Closing this issue as CImg is no longer used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants