Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Undefined reference error: (20 Items)
   
Undefined reference error  
1st scenario.

I am having 4 library projects and one application project. Application project is using all the 4 library files.
The libraries are BasicSignalProcessing, ePIAF, FileIO, MainMixer and application is MainMixerTestApplication.

1. ePIAF library project has the reference(Project References) on BasicSignalProcessing.
2. FileIO library project has the reference(Project References) on BasicSignalProcessing and ePIAF library project.
3. MainMixer library project has the reference(Project References) on BasicSignalProcessing and ePIAF library project. 
4. MainMixerTestApplication application project has the reference(Project References) on BasicSignalProcessing, ePIAF, 
FileIO and MainMixer library projects.

Individual libraries are getting built properly but MainMixerTestApplication is failing with error 'undefined reference 
to ...'.
I have added the necessary include folders in search paths and I am linking the above libraries by including them in 
'Properties->QNX C/C++ Project->Linker->Extra library paths'

Attached the build log for your reference.

Can anyone tell me what is the exact reason and how to get rid of this CRITICAL error ?

2nd scenario.

I have created a TestLib library project and TestMain application project where main function calls the TestLibProc 
function implemented in the test library. In this also I am getting similar error even though I am including the library
 while linking and it is getting resolved only if I include the OBJ file(TestLib.o) in the linker(Same is not happening 
in the 1st example as it is flashing an error in both MainMixer & MainMixerTestApplication). I feel including OBJ file 
is a crude method.
Attachment: Text ErrorLog.txt 17.48 KB
Re: Undefined reference error  
I have added the following command to in the 'other options' of the linker

'-Bstatic -lFileIO -lBasicSignalProcessing -lePIAF -lMainMixer -lm' and I am getting the below error :( ...

It is really IMPORTANT for us to get rid of these kind of errors ...

C:/ide-4.7-workspace/MainMixerTestApplication/private/exampleAppMainMixer.c:344: warning: 'fpOutName1' is used 
uninitialized in this function
C:/ide-4.7-workspace/MainMixerTestApplication/private/exampleAppMainMixer.c:352: warning: 'fpOutName2' is used 
uninitialized in this function
C:/QNX650/host/win32/x86/usr/bin/rm -f  C:/ide-4.7-workspace/MainMixerTestApplication/arm/o-le-g/
MainMixerTestApplication_g
C:/QNX650/host/win32/x86/usr/bin/qcc -Vgcc_ntoarm -Wl,--no-keep-memory  -Bstatic -lFileIO -lBasicSignalProcessing -
lePIAF -lMainMixer -lm    -oC:/ide-4.7-workspace/MainMixerTestApplication/arm/o-le-g/MainMixerTestApplication_g    
exampleAppMainMixer.o   -L . -L C:/ide-4.7-workspace/FileIO/arm/a-le-g -L C:/ide-4.7-workspace/BasicSignalProcessing/arm
/a-le-g -L C:/ide-4.7-workspace/ePIAF/arm/a-le-g -L C:/ide-4.7-workspace/MainMixer/arm/a-le-g -L C:/QNX650/target/qnx6/
armle/lib -L C:/QNX650/target/qnx6/armle/usr/lib  -Wl,--rpath-link . -Wl,--rpath-link C:/ide-4.7-workspace/FileIO/arm/a-
le-g -Wl,--rpath-link C:/ide-4.7-workspace/BasicSignalProcessing/arm/a-le-g -Wl,--rpath-link C:/ide-4.7-workspace/ePIAF/
arm/a-le-g -Wl,--rpath-link C:/ide-4.7-workspace/MainMixer/arm/a-le-g -Wl,--rpath-link C:/QNX650/target/qnx6/armle/lib -
Wl,--rpath-link C:/QNX650/target/qnx6/armle/usr/lib    -EL   -g       
C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: cannot find -lFileIO
make.exe[2]: Leaving directory `C:/ide-4.7-workspace/MainMixerTestApplication/arm/o-le-g'
make.exe[1]: Leaving directory `C:/ide-4.7-workspace/MainMixerTestApplication/arm'
cc: C:/QNX650/host/win32/x86/usr/bin/ntoarm-ld caught signal 1
make.exe[2]: *** [C:/ide-4.7-workspace/MainMixerTestApplication/arm/o-le-g/MainMixerTestApplication_g] Error 1
make.exe[2]: Target `all' not remade because of errors.
make.exe[1]: [all] Error 2 (ignored)
Re: Undefined reference error  
Looking like linker in the IDE is so bad that i is complaining about each and every linked library and it requires .o 
files to be specified !!! a crude requirement :) ofcourse along with the library !
Re: Undefined reference error  
You need to set the linker search path so that it can find the
libraries.  You may want to consult the IDE documentation.

On Thu, 2010-09-02 at 10:24 -0400, Girisha SG wrote:
> Looking like linker in the IDE is so bad that i is complaining about each and every linked library and it requires .o 
files to be specified !!! a crude requirement :) ofcourse along with the library !
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post65652
> 
Re: Undefined reference error  
I had set the linker search path in 'linker->Extra library paths' and I had mentioned the library name in 'linker->Extra
 libraries' and even then i was getting the linker error however after specifying couple of object files in 'linker->
Extra object files' for MainMixerTestApplication(application) and MainMixer(library) it is getting built properly. 

I am of the opinion that specifying the object files in the project is a crude method. Ofcourse the libraries that are 
built are already using these object files and I am specifying these libraries while linking !!!

Any insights how I can get rid of this ?
Re: Undefined reference error  
All -l options should be at the end of the command line. Where is libFileIO.a?

On 02/09/10 09:21 AM, Girisha SG wrote:
> I have added the following command to in the 'other options' of the linker
> 
> '-Bstatic -lFileIO -lBasicSignalProcessing -lePIAF -lMainMixer -lm' and I am getting the below error :( ...
> 
> It is really IMPORTANT for us to get rid of these kind of errors ...
> 
> C:/ide-4.7-workspace/MainMixerTestApplication/private/exampleAppMainMixer.c:344: warning: 'fpOutName1' is used 
uninitialized in this function
> C:/ide-4.7-workspace/MainMixerTestApplication/private/exampleAppMainMixer.c:352: warning: 'fpOutName2' is used 
uninitialized in this function
> C:/QNX650/host/win32/x86/usr/bin/rm -f  C:/ide-4.7-workspace/MainMixerTestApplication/arm/o-le-g/
MainMixerTestApplication_g
> C:/QNX650/host/win32/x86/usr/bin/qcc -Vgcc_ntoarm -Wl,--no-keep-memory  -Bstatic -lFileIO -lBasicSignalProcessing -
lePIAF -lMainMixer -lm    -oC:/ide-4.7-workspace/MainMixerTestApplication/arm/o-le-g/MainMixerTestApplication_g    
exampleAppMainMixer.o   -L . -L C:/ide-4.7-workspace/FileIO/arm/a-le-g -L C:/ide-4.7-workspace/BasicSignalProcessing/arm
/a-le-g -L C:/ide-4.7-workspace/ePIAF/arm/a-le-g -L C:/ide-4.7-workspace/MainMixer/arm/a-le-g -L C:/QNX650/target/qnx6/
armle/lib -L C:/QNX650/target/qnx6/armle/usr/lib  -Wl,--rpath-link . -Wl,--rpath-link C:/ide-4.7-workspace/FileIO/arm/a-
le-g -Wl,--rpath-link C:/ide-4.7-workspace/BasicSignalProcessing/arm/a-le-g -Wl,--rpath-link C:/ide-4.7-workspace/ePIAF/
arm/a-le-g -Wl,--rpath-link C:/ide-4.7-workspace/MainMixer/arm/a-le-g -Wl,--rpath-link C:/QNX650/target/qnx6/armle/lib -
Wl,--rpath-link C:/QNX650/target/qnx6/armle/usr/lib    -EL   -g       
> C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: cannot find -lFileIO
> make.exe[2]: Leaving directory `C:/ide-4.7-workspace/MainMixerTestApplication/arm/o-le-g'
> make.exe[1]: Leaving directory `C:/ide-4.7-workspace/MainMixerTestApplication/arm'
> cc: C:/QNX650/host/win32/x86/usr/bin/ntoarm-ld caught signal 1
> make.exe[2]: *** [C:/ide-4.7-workspace/MainMixerTestApplication/arm/o-le-g/MainMixerTestApplication_g] Error 1
> make.exe[2]: Target `all' not remade because of errors.
> make.exe[1]: [all] Error 2 (ignored)
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post65640
> 
Re: Undefined reference error  
I had set the linker search path in 'linker->Extra library paths' and I had mentioned the library name in 'linker->Extra
 libraries' and even then i was getting the linker error however after specifying couple of object files in 'linker->
Extra object files' for MainMixerTestApplication(application) and MainMixer(library) it is getting built properly. 

I am of the opinion that specifying the object files in the project is a crude method. Ofcourse the libraries that are 
built are already using these object files and I am specifying these libraries while linking !!!

Any insights how I can get rid of this ?
Re: Undefined reference error  
Can you list files in your

 C:/ide-4.7-workspace/FileIO/arm/a-
le-g


Does the library name have "_g" appendded, e.g. libFileIO_g.so ?

If so, you need to add it as "-lFileIO_g".

Re: Undefined reference error  
waveFileFunctions.o
libFileIO_g.a
Makefile

are the threee files in this folder. However when I try to add new library using linker options tab it shows only one 
library 'static' and it seems to me that it actually links release version of the library
Re: Undefined reference error  
The issue with the linker complaining about not finding "FileIO" was due
to you trying to link libFileIO.a and you had libFileIO_g.a in your -L
path.

What you are reporting now looks like you are adding both "-g" and
release paths in -L, release being first, and still specifying -lFileIO
which will link the "libFileIO.a" and NOT "libFileIO_g.a". For "_g" to
be linked, you need to specify "-lFileIO_g".


On Mon, 2010-09-06 at 04:24 -0400, Girisha SG wrote:
> waveFileFunctions.o
> libFileIO_g.a
> Makefile
> 
> are the threee files in this folder. However when I try to add new library using linker options tab it shows only one 
library 'static' and it seems to me that it actually links release version of the library


>From the command line you pasted in one of the previous posts, options
you pass to the linker (-L) show that only static libraries were listed
in the search path. Shared objects are in "so-le[-g]" directories.


Re: Undefined reference error  
What are the actual files of your libraries? e.g. ePIAF, what is the
file name (full name)?


On Thu, 2010-09-02 at 07:29 -0400, Girisha SG wrote:
> 1st scenario.
> 
> I am having 4 library projects and one application project. Application project is using all the 4 library files.
> The libraries are BasicSignalProcessing, ePIAF, FileIO, MainMixer and application is MainMixerTestApplication.
> 
> 1. ePIAF library project has the reference(Project References) on BasicSignalProcessing.
> 2. FileIO library project has the reference(Project References) on BasicSignalProcessing and ePIAF library project.
> 3. MainMixer library project has the reference(Project References) on BasicSignalProcessing and ePIAF library project.
 
> 4. MainMixerTestApplication application project has the reference(Project References) on BasicSignalProcessing, ePIAF,
 FileIO and MainMixer library projects.
> 
> Individual libraries are getting built properly but MainMixerTestApplication is failing with error 'undefined 
reference to ...'.
> I have added the necessary include folders in search paths and I am linking the above libraries by including them in 
'Properties->QNX C/C++ Project->Linker->Extra library paths'
> 
> Attached the build log for your reference.
> 
> Can anyone tell me what is the exact reason and how to get rid of this CRITICAL error ?
> 
> 2nd scenario.
> 
> I have created a TestLib library project and TestMain application project where main function calls the TestLibProc 
function implemented in the test library. In this also I am getting similar error even though I am including the library
 while linking and it is getting resolved only if I include the OBJ file(TestLib.o) in the linker(Same is not happening 
in the 1st example as it is flashing an error in both MainMixer & MainMixerTestApplication). I feel including OBJ file is a crude method.
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post65624

Re: Undefined reference error  
I had set the linker search path in 'linker->Extra library paths' and I had mentioned the library name in 'linker->Extra
 libraries' and even then i was getting the linker error however after specifying couple of object files in 'linker->
Extra object files' for MainMixerTestApplication(application) and MainMixer(library) it is getting built properly. 

I am of the opinion that specifying the object files in the project is a crude method. Ofcourse the libraries that are 
built are already using these object files and I am specifying these libraries while linking !!!

Any insights how I can get rid of this ?
Re: Undefined reference error  
Could be problems with order of the libraries. Do they have circular dependencies?
Re: Undefined reference error  
Yes I have circular dependencies.
Re: Undefined reference error  
How to resolve it and also can you suggest some links to refer to ?
Re: Undefined reference error  
sorry :( ... I have a relook at it but not very sure whether it has any circular dependency or not ... is there any 
other possibality also ?
Re: Undefined reference error  
If there is a circular dependency how to resolve it ?
Re: Undefined reference error  
Get rid of it. Either create another library or move some object files from one library to another. Or have just one 
library. If library depend on each other there is no point having two of them - because both are always required.
Of cause you can do what you did before - give object files directly to linker but fixing circular dependency is best 
option.

On 06/09/10 09:29 AM, Girisha SG wrote:
> If there is a circular dependency how to resolve it ?
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post66063
> 
Re: Undefined reference error  
But is the actual name of the file of your library something like
"libePIAF.so", or literally "ePIAF"?



On Fri, 2010-09-03 at 01:14 -0400, Girisha SG wrote:
> I had set the linker search path in 'linker->Extra library paths' and I had mentioned the library name in 'linker->
Extra libraries' and even then i was getting the linker error however after specifying couple of object files in 'linker
->Extra object files' for MainMixerTestApplication(application) and MainMixer(library) it is getting built properly. 
> 
> I am of the opinion that specifying the object files in the project is a crude method. Ofcourse the libraries that are
 built are already using these object files and I am specifying these libraries while linking !!!
> 
> Any insights how I can get rid of this ?
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post65824
> 

Re: Undefined reference error  
Library name is something like libePIAF.a but when I add it will take as ePIAF and I have referred to QNX document and 
according to that it is proper also as I have explained previously it is getting built after adding some more OBJECT 
files to resolve the dependencies.