aiekick / ImGuiFontStudio

Embedded Font Helper Gui Tool for programming
Apache License 2.0
392 stars 35 forks source link

Build on Visual Studio "lose some const-volatile qualifiers" #5

Closed chkone closed 3 years ago

chkone commented 4 years ago

Describe the bug Build error related to sfntly:

Errors:

To Reproduce

  1. CMake
  2. Build Solution

Visual Studio 2019 - 14.26.28720 (tested \c++lastest)

Expected behavior Built project.

Screenshots

Desktop (please complete the following information):

aiekick commented 4 years ago

Hello,

oups i just seen your post. thanks :)

Yes its a well know problem only with VS 2019 msvc compiler Its work nice with oldest version of the compiler.

I tried to correct it but i dont know how why there is a probleme for me the code is ok. if you can fix it. its cool. :)

Virato913 commented 4 years ago

@aiekick hey, I was just compiling your project and came across the same issue. Basically, your version of your 3rd party lib sfntly is outdated and that's why it gives that specific error on the VS2019 compiler. I'd suggest updating your version of that lib, or you can manually add the const qualifier to the operator() overloads on the header.h and header.cc files like this:

//header.h
class HeaderComparator {
 public:
  virtual ~HeaderComparator() {}
  virtual bool operator()(HeaderPtr h1,
                          HeaderPtr h2) const = 0;
};

class HeaderComparatorByOffset : public HeaderComparator {
 public:
  virtual ~HeaderComparatorByOffset() {}
  virtual bool operator()(HeaderPtr h1,
                          HeaderPtr h2) const;
};

class HeaderComparatorByTag : public HeaderComparator {
 public:
  virtual ~HeaderComparatorByTag() {}
  virtual bool operator()(HeaderPtr h1,
                          HeaderPtr h2) const;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//header.cc
bool HeaderComparatorByOffset::operator() (HeaderPtr lhs,
                                           HeaderPtr rhs) const {
  return lhs->offset_ > rhs->offset_;
}

bool HeaderComparatorByTag::operator() (HeaderPtr lhs,
                                        HeaderPtr rhs) const {
  return lhs->tag_ > rhs->tag_;
}
aiekick commented 4 years ago

ok i will check, btw, i made a copy because i modified a bit this lib. but in fact its too mush complicated for nothing. currently im writing my lib for read/write/rasterize font file (also for support of colored glyph but more tiny than with freetype), so i will abandonne this lib at least but thanks for the fix btw, i will apply your fix for the moment :)