Menu

Undefined reference to `___builtin_vec_new'

Ed D
2008-01-08
2012-09-26
  • Ed D

    Ed D - 2008-01-08

    I'm trying to create a dynamic two dimensional array. My code looks like this:

    define DEF_FrameBuffer_H

    class FrameBuffer {
    public:
    FrameBuffer(int prmWidth, int prmHeight, unsigned long prmPen);
    FrameBuffer(int prmWidth, int prmHeight);

    private:
    int clsHeight, clsWidth, clsCurrX, clsCurrY;
    unsigned long **clsBuffer, clsPen;
    };
    ======================================================================

    include <cstdlib>

    include <iostream>

    include <string>

    // Declarations...

    ifndef DEF_FrameBuffer_H

    #include "FrameBuffer.h"

    endif

    // Constructors...
    FrameBuffer::FrameBuffer( int prmWidth,
    int prmHeight,
    unsigned long prmPen
    ) {
    int x, y;

    clsWidth = prmWidth;
    clsHeight = prmHeight;

    clsBuffer = new unsigned long *[prmWidth];
    if (clsBuffer) {
    for (x = 0; x < prmHeight; x++) {
    clsBuffer[x] = new unsigned long [prmHeight];
    clsBuffer[x][y] = prmPen;
    }
    }
    }

    FrameBuffer::FrameBuffer(int prmWidth, int prmHeight) {
    FrameBuffer::FrameBuffer(prmWidth, prmHeight, 0);
    }
    ======================================================================

    The program compiles fine, but the linker gives me the error: [Linker error] undefined reference to `___builtin_vec_new'

    I have no clue what this means except I suspect it has something to do with the "new" keyword. As far as I can tell, this should work. This is being compiled using Bloodshed's Dev-C++.

    Any and all clues greatly appreciated.

    Ed.

     
    • Ed D

      Ed D - 2008-01-09

      I was able to get the answer to my problem (with less attitude, thank goodness) on the comp.lang.c++ newsgroup.

      My little experiment started as a C program, and then I switched it over to C++. DevC++ allows me to change individual files between C and C++ but I didn't see where I could do that at the project level. Creating a new project as C++ and adding the original files back in fixed the problem.

      Ed.

       
      • cpns

        cpns - 2008-01-09

        You are not asked to do this for our benefit or amusement, the idea is to get you answers much more quickly. It is primarily for your benefit, although it does save us a lot of work and frustration, the attitude comes from the unnecessary work and frustration. comp.lang.c++ is a far larger community, here a few do more work.

        As an illustration of how and why the log is so useful in diagnosis, given your description of the eventual solution I am willing to bet that the log showed g++.exe being invoked for unit compilation but gcc.exe being invoked for linking. I would have spotted that very quickly, and given that I posted 80 minutes after you that is how long it would have taken for you to get an answer (actually less because the answer would have been shorter).

        James Kanze on comp.lang.c++ spotted your problem and it is a tribute probably to his knowledge and experience, but that was over 12 hours after your original post, and was a 'guess' from the limited information you gave. Even though he guessed correctly, it seems that you took the trouble it reinstall in the meantime. We could have saved you the trouble. That said I am sure had you posted the log on comp.lang.c++ you would have got an answer quickly and with less guessing, be it wild or inspired.

        Clifford

         
      • cpns

        cpns - 2008-01-09

        The easiest way is either what you just did, or edit the .dev file directly. It is plain text and easy to understand.

        Posting the log (as politely and without attitude requested in the "read first" thread - and it is not unreasonable to expect you to have read it first) would have shown all your compile and linker settings and would have enabled your problem to have been resolved quickly here in the first response.

        Clifford

         
    • cpns

      cpns - 2008-01-08

      The code will not link but not for the reason you gave; there is no main() or WinMain() function. I assume that you have not posted complete code. However to have got as far as linking the code must have compiled, so the code is largely irrelevant.

      You should first read the thread titled "PLEASE READ BEFORE POSTING A QUESTION" (obviously - you've read it already right!?). This explains a number of things you need to know such as how to post a question on this forum in a way that gives it a far better chance of getting a correct solution first time without us asking you lots of annoying questions. Critically you should post the Compile Log, there is more useful information there than just the error messages. It also explains how you should uninstall and reinstall Dev-C++ (which you may have to do) in a way that avoids problems. This is especially important if you have ever installed an earlier version or installed incorrectly or 'customised' it in any way.

      I searched the forum (something you might have done), and this error does not appear to have been reported since 2005. All occurances were related to WinBGIm library, but more specifically the use of a GCC 2.95 build of that library with GCC 3.x. So my guess at present is that you are using an out of date library.

      Clifford.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.