473,326 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Linker error: undefined reference to `___builtin_vec_new'

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.
Jan 8 '08 #1
6 3497
OK, I just compiled this in Visual C++ and it compiled fine. It must be
a compiler problem, so I'm taking it over to the Bloodshed C++ forum.
Still, any clues are still welcome for any who are willing to help. :)
Ed Dana wrote:
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;
};
================================================== ====================
Jan 8 '08 #2
Ed Dana wrote:
OK, I just compiled this in Visual C++ and it compiled fine. It must be
a compiler problem, so I'm taking it over to the Bloodshed C++ forum.
Still, any clues are still welcome for any who are willing to help. :)
Undefined references usually mean that you included a header file
correctly (thus the compiler doesn't complain) but have to supply the
according library for the linker, so the precompiled function code can
be linked into your final executable. It should be solvable with the
correct -lLIBRARY option and maybe -LPATHTOLIBRARY for the linker.

Best Regards,

Lars
Jan 9 '08 #3
On Jan 8, 11:27 pm, Ed Dana <EDan...@Cox.netwrote:
OK, I just compiled this in Visual C++ and it compiled fine.
It must be a compiler problem, so I'm taking it over to the
Bloodshed C++ forum. Still, any clues are still welcome for
any who are willing to help. :)
It's probably one of two things: your compiler is not installed
correctly, or for some reason, it is trying to link the code as
if it were C and not C++ (and thus not picking up the run-time
support for C++). (G++ will do this if you compile and link
with the command gcc: gcc is the basic compiler driver, which
doesn't really know about C++ -- it will invoke the correct
compiler, according to the source file suffix, but it will only
append the minimum libraries for C, typically libc.a on a Unix
system when linking. Invoking g++ will ensure that the C++
runtime support is linked in as well.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jan 9 '08 #4
On Jan 9, 10:34 am, Lars Uffmann <a...@nurfuerspam.dewrote:
Ed Dana wrote:
OK, I just compiled this in Visual C++ and it compiled fine.
It must be a compiler problem, so I'm taking it over to the
Bloodshed C++ forum. Still, any clues are still welcome for
any who are willing to help. :)
Undefined references usually mean that you included a header
file correctly (thus the compiler doesn't complain) but have
to supply the according library for the linker, so the
precompiled function code can be linked into your final
executable. It should be solvable with the correct -lLIBRARY
option and maybe -LPATHTOLIBRARY for the linker.
The symbol he was missing was __builtin_vec_new. A symbol
starting with two underscores does not come from a user defined
library (hopefully, at least), but from the runtime support of
C++. The library with the necessary runtime support should be
pulled in automatically, *if* he uses a compiler driver to
invoke the link, that compiler driver is C++ aware, and knows
(or supposes) that the code being linked is C++.

(Note that the command we usually use to invoke the
"compiler"---cl, CC or g++ on my systems---really invokes a
compiler driver---a small program which invokes the actual
compiler, but also the linker, and in some cases the library
manager. And that while cl seems to be the only compiler driver
for VC++, and always supposes C++, cc and gcc exist along side
of CC and g++, and will not link in the C++ runtime support when
they invoke the linker.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jan 9 '08 #5
James Kanze wrote:
The symbol he was missing was __builtin_vec_new. A symbol
starting with two underscores does not come from a user defined
library (hopefully, at least), but from the runtime support of
C++. The library with the necessary runtime support should be
pulled in automatically, *if* he uses a compiler driver to
invoke the link, that compiler driver is C++ aware, and knows
(or supposes) that the code being linked is C++.
Hmm - I guess I should keep my mouth shut and focus on my real strengths
- developing solutions rather than spread my very limited knowledge
about compiler and linker issues *g*

Didn't know the underscore-convention. Thanks for clearing that up.
Jan 9 '08 #6
Reinstalling didn't work. However, your info got me to thinking... 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.

Thanks for the clues! I needed them. ;)

Ed.
James Kanze wrote:
On Jan 8, 11:27 pm, Ed Dana <EDan...@Cox.netwrote:
>OK, I just compiled this in Visual C++ and it compiled fine.
It must be a compiler problem, so I'm taking it over to the
Bloodshed C++ forum. Still, any clues are still welcome for
any who are willing to help. :)

It's probably one of two things: your compiler is not installed
correctly, or for some reason, it is trying to link the code as
if it were C and not C++ (and thus not picking up the run-time
support for C++). (G++ will do this if you compile and link
with the command gcc: gcc is the basic compiler driver, which
doesn't really know about C++ -- it will invoke the correct
compiler, according to the source file suffix, but it will only
append the minimum libraries for C, typically libc.a on a Unix
system when linking. Invoking g++ will ensure that the C++
runtime support is linked in as well.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jan 9 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: GammaJoe | last post by:
I'm relatively new to C++, and so when I ran across these linker errors, I really didn't know how to fix them. I did a groups.google search, and found plenty of issues with parameterized classes,...
3
by: Lord Labakudas | last post by:
Hi, I have the following simple template implementation: // -------------- b.h ----------------- // template <class t> class b { public: b() ;
12
by: Baloff | last post by:
Hello I have this linker error which makes me think that the definition file is not being seen by the linker, this code is taken from "Thinking in C++, 2nd Edition, Volume 1, Annotated Solutions...
4
by: Mark | last post by:
Hi, I'm trying to write some classes that kind of manage themselves. A linked list, that links different types of objects. Here's the code... object.h: --- class Object { int alt;
5
by: Mark | last post by:
Sorry for creating such a newbish topic, but I just can't seem to figure out what the problem is here. // main.cpp #include <cstdlib> #include <iostream> #include "Vector.h" using namespace...
3
by: prakash.mirji | last post by:
Hello, I am getting below mention linker error when I tried to link my class test.C I use below command to compile test.C /usr/bin/g++ -g -fpic -fvisibility=default -D_POSIX_SOURCE...
1
by: Herman.Schultz | last post by:
I am getting the following undefined reference linker error when I compile my program: FileModule.o: In function `DoFile': /home/herman/src/FileModule.cpp:665: undefined reference to `VLC_Init'...
1
by: mubbashir | last post by:
I just created a program and used public inheritance. when compiling I am getting linker error of this kind. undefined reference to `Person::Person(char *)' undefined reference to...
3
by: Rahul | last post by:
Hi Everyone, I have the following polymorphic classes, class Shape { public : virtual void draw() { } virtual void sample();
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.