Linker error while using g++4.1.2 in RHEL5
Linker error while using g++4.1.2 in RHEL5
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*)'
rypt.cpp.text+0x211): undefined reference to `h::readPassword()'
rypt.cpp.text+0x229): undefined reference to `h::string2CString(ACE_String_Base<char> const&)'
rypt.cpp.text+0x233): undefined reference to `h::decrypt(char const*)'
rypt.cpp.text+0x473): undefined reference to `h::readPassword()'
rypt.cpp.text+0x47e): undefined reference to `h::string2CString(ACE_String_Base<char> const&)'
rypt.cpp.text+0x488): undefined reference to `h::encrypt(char const*)'
collect2: ld returned 1 exit status
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)
|