Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Pretty much what the title says. Whenever I try to use objects, I get these errors (after a very long stack trace):

Code:
undefined reference to `operator new(unsigned int)'


Code:
undefined reference to `operator delete(void*)'


Code:
undefined reference to `___gxx_personality_v0'


I can compile non-oop code just fine. I am on Windows 10 compiling for the fx-CG50.

Here is the source. All help appreciated.


Code:

#include <fxcg/display.h>
#include <fxcg/keyboard.h>
#include <fxcg/rtc.h>
#include <fxcg/misc.h>

#include "triangles.hpp"

color_t TriShader(int x, int y)
{
    return COLOR_AZURE;
}

int main()
{
    PrintXY(3, 8, "--Hello World!", TEXT_MODE_NORMAL, TEXT_COLOR_RED);

    Triangle* tri = new Triangle(&TriShader, 0, 0, 100, 100, 100, 0);
    tri->Shade();

    Bdisp_PutDisp_DD();

    delete tri;

    int key;
    while (1)
    {
        GetKey(&key);
    }

    return 0;
}


Triangle class header:
https://pastebin.com/sKRp7cwx]

Stack trace:
https://pastebin.com/fn3XzEEK

idk what the reference to d:\mingw etc is, I think it's from the machine that built it. d:/library etc is my own path
The new and delete operators require runtime library support that isn't implemented for the Prizm. You'll have to use malloc and free "manually".
You can add following to your code:

void* operator new(size_t size) { return malloc(size);}
void operator delete(void* p){ if(p != NULL) { free(p); }}
void* operator new[](size_t size){ return malloc(size);}
void operator delete[](void* p){ if(p != NULL) { free(p); }}
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement