This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Linking problems with gcc and AIX
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: mhuffaker at s3groupinc dot com
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 02 Jan 2007 15:38:11 -0500
- Subject: Linking problems with gcc and AIX
> I'm having problems compiling and linking my program on AIX using gcc and
> the AIX linking. This program was orginally coded on RedHat Enterprise 4
> and compiles and links fine there. I'm getting multiple undefined symbols
> on the link, even though I have all the libraries on the command line and
> the paths are correct.
> g++ -maix64 -Xlinker -bexpfull -Xlinker -brtl -I.
> -I/usr/include/c++ -I/app/oracle/ora10g/rdbms/public -I../include
> -L/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0 -L/lib -L/usr/lib
> -L/app/oracle/ora10g/lib -L../lib
> -L/home/mhuff/source/HugoBoss/cpp/UPCLabelPrint_3 -lclntsh -locci -lLog
> -lLabelUtil -lRFWindowBase -lncurses -lLog -lgcc -lstdc++ -lsupc++
> -lncurses -o UPCLabelPrintWin UPCLabelPrintWin.cpp main.cpp
First, you are compiling and linking the application in 64-bit
mode (-maix64), but pointing at 32-bit libraries
(/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0).
All of the pointing at explicit GCC paths and linking with
explicitly GCC libraries is unnecessary and causing your problems. You
should not do that on AIX or RHEL 4 or .... Using "g++" as the link
command implicitly will link with the correct GCC libraries.
Remove -L/opt/freeware/... and "-lgcc -lstdc++ -lsupc++" from your
Makefile and try again.
David