473,804 Members | 3,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

" undefined reference to" g++ error

3 New Member
Hello,

i am trying to compile a code(main.cpp) which uses a function that is declared in a header file that is within the directory where the main.cpp file resides so the header is included as
#include"abc.h"

that function's definition is inside abc.cpp that also resides in the directory of main.cpp i.e with abc.h

but still on usage of that function i get "undefined reference to" that function error....

How is this possible??

Please can anybody help me out with this.

Thanks

Best Regards
Feb 2 '08 #1
1 2146
weaknessforcats
9,208 Recognized Expert Moderator Expert
You don't say whether this is a compiler error or a linker error.

If it's a compiler error of undefined reference:
a) you are a calling a function that is not the header
b) you are calling a function that is in the header but the arguments don't match the prototype in the header.

If it's a linker error, then your abc.cpp was not part of your make file.

You might post the relevant header lines plus the call where you are getting the error. Include the definitions of the argument variables.
Feb 2 '08 #2

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

Similar topics

2
13127
by: RU | last post by:
Hi, I am working on a porting project to port C/C++ application from unixware C++, AT&T Standard components to g++ with STL on Linux. This application has been working properly on Unixware/C++/AT&T componets environment. I have been able to compile all modules after making necessary changes in LINUX/gcc/STL environment. We have two templates defined XList and XMap.
2
1793
by: Jozef | last post by:
Hello, I have a friend in the UK and another in Denmark that I sent an Access XP database to. I used the Package and Deployment wizard to create this file. The only reference that I added was DAO 3.6. The users on the other side of the ocean went through the set up and everything installed fine, but they received an error indicitive of a reference error. The odd thing is, all the references seem to be there. I CAN'T duplicate the...
2
1134
by: TJS | last post by:
i get a reference error to CssDropDown object when the session expires Why is object reference on "CssDropDown" not being found ? ======================================================== Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Line for Error: ....
16
2311
by: Paul S. Natanson | last post by:
What is a Null Reference error and how do I fix it? My newly installed VB.Net2003 gives me a "Microsoft Development Environment" error message box EVERY time I try to run/start ANY project - even very simple ones. The error says: "An unhandled exception of type 'System.NullReferenceException' occurred in
6
2641
by: Nadia | last post by:
Hi, I am having the symbol reference error while linking the object files. I have added the library at the end of the commmand . g++ -D_XWIN -DRT_DIAG=cerr -DRT_INFO=cerr -I/usr/X11R6/include -o simex AuxFctns.o CompList.o Composed.o Event.o FandCOp.o IconDraw.o Pane.o \ Ph1.o Ph2.o Ph3.o Ph4.o Ph4Run.o Ph5.o RTSigSup.o RunTime.o SchCell.o Schmtc.o \ ScrnTile.o Signal.o Sim.o SkewHeap.o SupDisp.o SupProbe.o SwList.o
40
3229
by: vfunc | last post by:
I get an undefined reference error for a definition that clearly looks like it is in a .h file. So what can be the cause of an undefined reference error, when this .h file containing the definition has been included and the namespace has been declared. I blame engineers they are all ponsey zealots.
6
6248
by: mihailsmilev | last post by:
Hello, let me first describe the situation: I am developing an application using Qt Designer 3.3.5 on OpenSuSE Linux for my mp3 player. So I need to get the id3 tags from the mp3 files, and I've downloaded the sources of id3lib. I've included the headers (there are no other files) in my project in Qt designer, then created an object from my files. When starting the make command, it compiles normally all the headers (although giving some...
8
9906
by: utab | last post by:
Dear all, I am getting an undefined reference error wrn I try to initilialize a static map in the class constructor. my map: map<string,vector<string> > m; and in the constructor classname::classname(){
8
3549
by: vfunc | last post by:
I get compile error: undefined reference to snd_pcm_format_width. I included the library directory with -I flag on gcc. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sched.h> #include <errno.h> #include <getopt.h>
6
3232
by: SunshineInTheRain | last post by:
can anyone please help me on problem of 'Sys' is undefined error? I know a lot forum has discussed about this, but none i success to solve the error. I have run it on Window server 2000, IIS 5, Ajax extension 1.0 Installed, Just newly install .net Framework 2.0 where .net framework 1.0 are still using at the same time. The root application are using version 2.0. when create website from vs.net2005 and compile, does not have error. but...
0
9704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9569
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
10558
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
10318
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
10302
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
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7608
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
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();...
3
2975
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.