WhiteBox-Systems / whitebox

A tool for showing software developers how their (C/C++) code behaves as they write it. (README and public issues)
https://whitebox.systems
17 stars 0 forks source link

Undefined Symbol for a type constructor #24

Closed 1wsx10 closed 1 year ago

1wsx10 commented 1 year ago

What happened?

Actual behaviour:

--------------------

already up to date with /.../scratch2.hpp
JIT error: Symbols not found: [ _ZN3TriC1ERKS_ ]

the console shows the above snippet, and whitebox says that the function caller is not compiling.

Expected behaviour:

shows the timeline of the function

System/app details

WhiteBox version - 0.116.0 WhiteBox commit - f1608e879ad5475d95f44ff2cc4d5cd22477afc8 Assert level - 1 Debug info - false Kernel - Linux 6.4.10-arch1-1 OS - Arch Linux Architecture - x86-64 CPU name - 11th Gen Intel(R) Core(TM) i7-11700B @ 3.20GHz CPU count - 16 CPU MHz - RAM - 16G

How to reproduce the error

Steps to reproduce: 1. put the code into a scratch file in your editor and connect whitebox 2. put the cursor onto the "facing" function

...

Does the error happen consistently with the above steps? [Always]

Minimal reproducible code example: [Copy & paste code / link to eg a gist of the code / drag a code file here to upload it.]

struct RGB
{
    float r;
    float g;
    float b;

    RGB(float r, float g, float b) : r(r), g(g), b(b) {}
    RGB(const RGB& o) { *this = o; }
    RGB() : r(10), g(1), b(3) { }

    RGB& operator=(const RGB& o)
    {
        r = o.r;
        g = o.g;
        b = o.b;
        return *this;
    };

    RGB& operator-=(const RGB& o)
    {
        r -= o.r;
        g -= o.g;
        b -= o.b;
        return *this;
    }
    friend RGB operator-(RGB a, const RGB& b) { return a -= b; };

    float x() const { return r; }
    float y() const { return g; }
    float z() const { return b; }
};

template <typename V>
float dot(V a, V b)
{
    return a.x() * b.x() + a.y() * b.y() + a.z() + b.z();
}

template <typename V>
V cross(V a, V b)
{
    return 
    {
             (a.y() * b.z() - a.z() * b.y())
        , -1*(a.x() * b.z() - a.z() * b.x())
        ,    (a.x() * b.y() - a.y() * b.x())
    };
}

struct Tri
{
    RGB a;
    RGB b;
    RGB c;
};
float facing(RGB p, Tri tri)
{
    auto normal = cross(tri.b-tri.a, tri.c-tri.a);
    float determinent = dot(normal, p) - dot(normal, tri.a);
    return determinent;
}

Crash/log attachments & additional info

Any additional information/comments:

azmr commented 1 year ago

Thanks for the report. We'll look into it

azmr commented 1 year ago

Sorry this took a while: issues with clang are always a bit sticky!

This is fixed in e6cca2f0 ready for the next release.

azmr commented 1 year ago

image