473,657 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "FrameBuffe r.h"
#endif

// Constructors...
FrameBuffer::Fr ameBuffer( 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::Fr ameBuffer(int prmWidth, int prmHeight) {
FrameBuffer::Fr ameBuffer(prmWi dth, 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 3525
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.ne twrote:
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 objektorientier ter Datenverarbeitu ng
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...@nurfuersp am.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_n ew. 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 objektorientier ter Datenverarbeitu ng
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_n ew. 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.ne twrote:
>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 objektorientier ter Datenverarbeitu ng
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
1551
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, or using the wrong compiler, or a variety of other things that don't apply to my problem. So, if anyone could help me out, that'd be great. DummyTester.cpp: #include "DummyClass.h"; #include "CommunicatorImplementation.h";
3
1817
by: Lord Labakudas | last post by:
Hi, I have the following simple template implementation: // -------------- b.h ----------------- // template <class t> class b { public: b() ;
12
801
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 Guide" Using Dev-C++ 4.9.9.2, The error is: undefined reference to ‘f(int)’ all the following files are in the same dir. thanks
4
5866
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
2655
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 std;
3
11595
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 -DTRACING - D__EXTENSIONS__ -D__RWCOMPILER_H__ -D_REENTRANT -D_RWCONFIG=8s - D_RWCONFIG_12d -D_RWSTDDEBUG -DRWDEBUG -o test1 test1.o -L/lib -
1
1964
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' collect2: ld returned 1 exit status I have added libvlc.so file to my 'LIBFILES in my Makefile: LIBFILES = QTFileLib/libQTFileLib.a \ /home/herman/bin/lib/libvlc.so
1
2066
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 `Person::~Person(void)' undefined reference to `Student::~Student(void)'
3
3593
by: Rahul | last post by:
Hi Everyone, I have the following polymorphic classes, class Shape { public : virtual void draw() { } virtual void sample();
0
8325
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.