Change g ++ default architecture on Mac OS X?

On Mac OS X 10.6, Apple changed the default target of g ++ to create 64-bit rather than 32-bit code. I know that I can specify "-arch i386" on the command line, but is there a way to globally change the default architecture using an environment variable or similar? (I keep getting binding errors because I am having real problems finding all the places that I need to point out in the architecture of the project I am transferring.)

+5
source share
2 answers

Not that I knew. Depending on the configuration used and the build system, customization CXXFLAGS, CFLAGSand LDFLAGSenvironment variables for inclusion -arch i386may help. However, some configuration and assembly systems are complex, and may not be enough to set these variables.

Another option is to provide g++(and friends if necessary) a bash script at the PATHlocation that precedes /usr/binand invokes the actual command using the -arch i386arguments passed to the script along with the command line.

, , arch(1) . , script arch -i386 /usr/bin/g++. ARCHPREFERENCE - g++:/usr/bin/g++:i386,x86_64 arch /usr/bin/g++. , arch /usr/bin/g++.

+2

1

, . bin g++ script, g++. .

2

g++. . .

. , , XCode, , g++.

0

All Articles