Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Issues Linking Eigen lib

  1. #1
    Junior Member
    Join Date
    Jun 2020
    Posts
    3

    Issues Linking Eigen lib

    Hello - I am having issues compiling the Eigen linear algebra library for teensy, first off here is the link to my github for the project: https://github.com/tobycyanide/teensytracer
    As far as I can tell this issue is because of the Teensy lib overriding the abs and round functions from the stdlib. I've been advised to move the teensy-specific code into a seperate file and create a C wrapper, and then import that wrapper, to create another layer of abstraction between the teensy core and my app code. However, I have no idea how to do this, I thought I would post here for some guidance.
    I'm getting errors like this:
    Code:
    error: expected unqualified-id before '(' token
      121 | #define abs(x) ({ \
    My source code is on the github, I'm passing -DDO_ARM=1 to build the teensy.


    Thanks so much,
    Adam

  2. #2
    Junior Member
    Join Date
    Sep 2018
    Posts
    19
    In most cases, you can just undefine these annoying macros.
    Here's what I use in my Linear Algebra library: ArduinoMacroFix.hpp.
    You have to include it before including any Eigen headers (and <cmath> or <algorithm>).

    Pieter

  3. #3
    Junior Member
    Join Date
    Jun 2020
    Posts
    3
    Awesome, thanks so much! That worked, I just had to add #undef B1 to it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •