473,396 Members | 2,024 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,396 software developers and data experts.

undefined reference to constructors and destructors

I could complie my code in one directory and the same piece of code in the other directory I couldnt complie the code..

I am working on the same machine ..

Its giving an eror saying as undefined reference to constructors and destructors.
I have checked the permissions of the directory also ..both are same..

complier I am using is g++
and operating system is linux..

could anyone help me out in solving this error..
Thanks in advance..
Oct 19 '07 #1
3 8467
gpraghuram
1,275 Expert 1GB
I could complie my code in one directory and the same piece of code in the other directory I couldnt complie the code..

I am working on the same machine ..

Its giving an eror saying as undefined reference to constructors and destructors.
I have checked the permissions of the directory also ..both are same..

complier I am using is g++
and operating system is linux..

could anyone help me out in solving this error..
Thanks in advance..
R u using multiple files...If yes have u copied all the files to the new directory?

Raghuram
Oct 19 '07 #2
R u using multiple files...If yes have u copied all the files to the new directory?

Raghuram
I have copied the directory by cp -r olddirectory newdirectory.....
but still not working....
Oct 19 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
You say it's a compile error.

The only way you get an unresoved reference at compile time is when the header file can't be located.

Since you have moved the files, the project is expecting the files in the original location.

When you #include <MyHeader.h> the preprocessor looks for the file in a sstandard place.
A standard place is a predefined path. Typically, there will be project settings where you can specify
the path (or paths) the preprocessor as additional include directories. The preprocessor will
search for your header file in the order of the specified paths.

When you #include "MyHeader.h" the preprocess looks for the file in the present working directory (PWD).
Typically, this is the folder that contains the project file itself. If the header file is not found
there, then the search continues as though you had coded #include <MyHeader.h>.

This allows you to make a copy of a header file and #include "MyHeader.h" so you can makes changes to it
without garbaging the original. Any code that #include <MyHeader.h> will use the original file
and will not see your revisions. After you have debugged you changes you can copy the revised header back
to the original folder.

Now of this is a linker error, then you are missing some source files in your build or have failed to include a libraary in your makefile as an additional linker dependency.
Oct 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Rajesh Garg | last post by:
Can we have private constructors and destructors? IF yes what is the use of such constructors or destructors.....in the sense where can these be implemented in a system................. I have...
3
by: Eric | last post by:
Ok, this is very strange. in TRegionGrower.h, I've got: -- template <class T> class TRegionGrower { public:
4
by: François Duranleau | last post by:
Hi! I was writing some piece of code and then, after pondering on some readings in "More Effective C++" by Scott Meyers (Item 10) and the book of Stroustrup (section 14.4.1 in the hardcover...
3
by: Amit | last post by:
is there anything like static constructors or destructors in C++ ? if yes, how to implement it? Thanks, Amit.
3
by: rahul8143 | last post by:
hello, I write a following program and have problem in understanding constructors and destructors. #include <iostream.h> class vector { public: double x; double y;
5
by: ElanKathir | last post by:
Hi All ! I want to know about the constructors & Destructors, constructors ---> New Destructors --> What ? (Which keyword to use for Destructor) Thanks & Regards, ElanKathir.S.N, ASM...
5
by: Alok | last post by:
hii Would somebody clear my doubts on following qustions . What are virtual constructors and virtual destructors ? Why can't we have virtual constructors ? What are demerits of inheritence in...
5
by: druberego | last post by:
I read google and tried to find the solution myself. YES I do know that you can get undefined references if you: a) forget to implement the code for a prototype/header file item, or b) you forget...
21
by: Michael Hull | last post by:
Hi, I remember from somewhere reading that inlining constructors is a 'BadThing', but now can't seem to find the original source. I can't however thing of a reason why it would be for simple...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.