Results 1 to 5 of 5
I have a cpp code, which we have been using in RHEL4 compiled using g++ version 3.4.6.We are now trying to port our application to RHEL5. For this, as the ...
- 05-08-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 13
[SOLVED] Linker error
I have a cpp code, which we have been using in RHEL4 compiled using g++ version 3.4.6.We are now trying to port our application to RHEL5. For this, as the first step, i copied our code to a RHEL5 box and tried to compile the code.
I get "Undefined Reference To" linker error. Kindly note that i have verified all the normal causes for linker errors. Its all fine.Linking fails for few functions in say file rypt.cpp. Those functions are actually declared in the header file which is already included.
The shared library containing the fucntion implementations is available at the linked path. Library path & name given in the linking command -L path and -llibname are all proper.Hence these are not the cause for the error.
undefined reference to `h::setKeyFile(char const*)'
I have doubts in following:
1.Compiler version is changed.It is g++ v4.1.2 that is used in RHEL5. Can that cause problem
2.Compiler configurations look different for the current g++ 4.1.2 and the one we were already using g++v3.4.6.Please find below the compiler versions/configurations.
Can some one let me know if g++4.1.2 is expected have some linker errors ? What could be causing such errors, could there be any linker /compiler settings that is needed which i am missing ?
Any pointers would be highly appreciated.
G++ v4.1.2
===========
root@imgw-test39 objdir]# g++ -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/4.1.2/specs
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)
G++ v3.4.6
===========
bash-3.00$ g++ -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
- 05-09-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Simply put, libraries that are expected which contain the implementations of the missing symbols / functions are missing or somewhere else on the RHEL 5 system. Determine what those are, where they might be, and if not on the system, install them as required. This is computer programming 101.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-11-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 13
All those are proper. The library is available at the location mentioned.Proper header files are included.
- 05-11-2009 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Then you should not be getting these errors. Sometimes missing symbols occur because you link in one library before other components/libraries that have a dependency on the former. The linker does not recursively search the linked libraries for these symbols, which gives the same results. Again, this is C Programming 101.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-13-2009 #5Just Joined!
- Join Date
- Jan 2009
- Posts
- 13
Thank you rubberman for all your responses. The issue is fixed. It was not because of any missing library or path as I mentioned above.
I had to install the package compat-gcc-34-c++-3.4.6-9 and modify my make file to point to g++34 which installed with this package. And also forced the g++34 compiler to read the specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs.
This resolved the issue.



