fixed_math icon indicating copy to clipboard operation
fixed_math copied to clipboard

[BUG] fix compilation error in example code on README.md

Open toge opened this issue 1 year ago • 1 comments

Describe the bug There is an compilation error in example code on README.md. https://github.com/toge/fixed_math/tree/master?tab=readme-ov-file#example

Error Message is following:

test_package.cpp:32:31: error: unable to find numeric literal operator ‘operator""_fix’
   32 |     some_fixed = some_float * 2.45_fix; //operation with float is promoted to fixed_t
      |                               ^~~~~~~~

It is lack of using fixedmath::operator ""_fix; or using namespace fixedmath;. Not sure which is more appropriate for the fixed_math coding style. Could you please fix it?

Build info:

  • OS: Fedora Linux
  • gcc 14.1.1
  • libstdc++11

toge avatar Jul 22 '24 16:07 toge

sure I'll create (ASAP) example.cc in fixedmath

mentioned operator is here

readme example is missing

using fixedmath::operator ""_fix;

arturbac avatar Jul 22 '24 17:07 arturbac

@arturbac Thanks!

toge avatar Jul 24 '24 01:07 toge