I have been trying to build a library in solaris using gcc, and keep on hitting wrong ELF class: ELFCLASS64
error. I have googled and found out this is due to trying to link with a 32 bit file which compiling as a 64 bit library. But I have made sure that I build rakesh.o as a 64 bit using -m64 compiler option.
/rdcomb/run/pd/gcc/32-bit/4.4.1/bin/g++ -Wall -W -Wunreachable-code -Winline -Wshadow -Weffc++ -Wfloat-equal -Wunsafe-loop-optimizations -Wcast-qual -Wdisabled-optimization -shared -fPIC -m64 -c -DDEBUG -I../include -I/home/radha/ali/trunk/src/top//src/ -I../../../top/include -g -o Suni386/dll/rakesh.o rakesh.cpp
xmake: /home/radha/ali/trunk/src/tools/bin/Suni386/xlink -g -o Suni386/dll/rakesh -p../../../top/gtcpp/Suni386/dll -lgtcpp -lsocket -lnsl Suni386/dll/rakesh.o
ld: fatal: file Suni386/dll/rakesh.o: wrong ELF class: ELFCLASS64
ld: fatal: file processing errors. No output written to Suni386/dll/rakesh
collect2: ld returned 1 exit status
/rdcomb/run/pd/gcc/32-bit/4.4.1/bin/g++ -g -o Suni386/dll/rakesh -L../../../top/gtcpp/Suni386/dll Suni386/dll/rakesh.o -lgtcpp -lsocket -lnsl
xmake: /home/radha/ali/trunk/src/tools/bin/Suni386/xlink: error 1 (0x1)
What am I doing wrong here? Is it due to some compiler flag that using or missing?