Pages

Thursday, January 31, 2013

What is the proper way to compile c++ code from the terminal?

I'm using:

 

g++ char.gpp

 

And I get:

 

ld: library not found for -lcrt1.10.6.o

collect2: ld returned 1 exit status

 

So I tried setting LIBRARY_PATH to a directory that contains crt1.10.6.o, but then I get:

 

ld: warning: in char.gpp, file was built for unsupported file format which is not the architecture being linked (x86_64)

Undefined symbols:

  "_main", referenced from:

      start in crt1.10.6.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

 

So clearly I am not picking up the right library, or perhaps just not all the libs needed. Why is this so hard? I haven't seen problems like this with earlier versions of Xcode.

 

I'm using the latest version of Xcode on a MacBook Pro with Lion installed.

 

Thanks,

 

Kim


View the original article here

0 comments:

Post a Comment