Git Product home page Git Product logo

Comments (10)

codeplea avatar codeplea commented on August 27, 2024

What is the commandline you're using to compile?

Maybe you need something like the -lm flag to link in the math library?

I really don't know. You might have better luck posting in an Arduino forum. Please report back if you do figure it out, though.

from tinyexpr.

ricxsar avatar ricxsar commented on August 27, 2024

I am not using command line to compile. I think the arduino ide automates the process. I will try to get help with the arduino forum. But likely they will respond to contact the author to fix the issue though.

from tinyexpr.

codeplea avatar codeplea commented on August 27, 2024

You should be able to see what the IDE is passing to the compiler somehow. I think it could be very helpful to know.

from tinyexpr.

codeplea avatar codeplea commented on August 27, 2024

I assume you've also added tinyexpr.c into your project somehow. You may need to make sure that it is being compiled as C and not as C++. Just a thought.

from tinyexpr.

ricxsar avatar ricxsar commented on August 27, 2024

Yes, I setup the ide to include your library including the source and the header file. It don't complain about undefined reference to the first function in the library which is te_interp so the library is included in the right way. I think the error is somewhere in line 119 on tinyexpr.c.

static const te_variable functions[] = {
118	    /* must be in alphabetical order */
119	    {"abs", fabs,     TE_FUNCTION1 | TE_FLAG_PURE, 0},

from tinyexpr.

codeplea avatar codeplea commented on August 27, 2024

What happens if you comment out line 119? Does it then complain that acos (from line 120) is undefined?

It seems like it's not linking against the math library. The usual way to do that on gcc is with the -lm flag. It could also be a C to C++ name mangling issue.

It also may be that the Arduino doesn't support pointers to functions, in which case you'd be out of luck.

from tinyexpr.

ricxsar avatar ricxsar commented on August 27, 2024

I tried your suggestion. It compiles successfully after commenting the fabs line. Do you know what is happening?

Maybe it is arduino issue?

from tinyexpr.

codeplea avatar codeplea commented on August 27, 2024

No, that's really odd. fabs is very much part of standard C.

TinyExpr should work fine with that line commented out, you just won't have access to the abs function (you could write your own very easily though).

You should ask someone who knows about Arduino and report back.

from tinyexpr.

ricxsar avatar ricxsar commented on August 27, 2024

Ok. I will. Thanks for the heads up.

By the way, can you add bitwise operations like &, | and !?
Those operations are very important to embedded systems.

from tinyexpr.

codeplea avatar codeplea commented on August 27, 2024

TinyExpr works with floating point, so bitwise operators don't really make sense there.

You could probably fork TinyExpr to use integers (I know at least one person already has) and then add those operators yourself pretty easily.

from tinyexpr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.