0

Basically, I want to run a .cpp and link several .a files and gcc,fortran. The command is as

g++ -L/Users/myhome/Ipopt-3.10.0/build/lib -lipopt -L/Users/myhome/lcoinmumps -lpthread -framework vecLib -L/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1 -L/usr/local/gfortran/lib -lgfortran -lgcc_static -lcc_kext -lgcc -lSystem -framework vecLib -framework vecLib -lm -ldl -o cpp_example cpp_example.cpp

The error shows as

ld: warning: ld: warning: ignoring file /Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/libgcc_static.a, file was built for archive which is not the architecture being linked (x86_64): /Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/libgcc_static.a ignoring file /Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/libgcc.a, file was built for archive which is not the architecture being linked (x86_64): /Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/libgcc.a

Undefined symbols for architecture x86_64: "MyNLP::MyNLP()", referenced from: _main in ccY99KRH.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status

As bold text shows, the error seems to be I am running on 32bit kernel or CPU. But I am using x86_64: i've changed boost.plist according to here and 'about mac' proves clearly that both hardware and software I am using now is 64bit.

Here seems to have explained that mac architecture(?) somehow could not be recognized 64 bits.

But when I add files (.a .cpp .h) into Xcode and run the project together, it works fine.

Anyone knows why the command line doesn't work? Why my libgcc(i686-apple-darwin11-llvm-gcc-4.2) could not be recognized as 64bit version? And most importantly, how to get commands to work?

BTW, my system is lion 10.7.4

Community
  • 1
  • 1
Elizabeth
  • 491
  • 1
  • 4
  • 9
  • 1
    Just to make sure, are you _trying_ to compile 32-bit or 64-bit? – Joachim Isaksson Oct 09 '12 at 17:47
  • @JoachimIsaksson I am trying to compile 64bit. But the error message said that the libgcc files "was built for archive which is not the architecture being linked (x86_64)". – Elizabeth Oct 10 '12 at 04:15
  • 1
    The x64 libs are in `/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64`, but I strangely don't see libgcc_static.a there. – Joachim Isaksson Oct 10 '12 at 04:51
  • @JoachimIsaksson Try 'cd /Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1' directly, not the Developer folder under Applications directory. The Developer folder is at same directory level as Applications folder :) – Elizabeth Oct 10 '12 at 07:34

0 Answers0