I try to run a very simple code, but it reports error, can anyone give some suggestions? I am using Ubuntu14 and gcc4.9.
xin@ubuntu:~/pipes$ gcc -arch i386 -arch x86_64 channel.cpp
gcc: error: i386: No such file or directory
gcc: error: x86_64: No such file or directory
gcc: error: unrecognized command line option ‘-arch’
gcc: error: unrecognized command line option ‘-arch’
Looks like you are trying to use the Apple OS/X (Darwin) GCC/CLang method of compiling code to a universal binary with 2 architectures.
It is different on Linux (including Ubuntu). Linux doesn't have universal binary support for multiple targets in a single executable. It is one architecture per build. Remove
-arch i386 -arch x86_64
and replace it with-m32
if you are targeting a 32-bit binary, and-m64
if targeting a 64 bit binary.32-bit:
64-bit
Special Considerations
You may also have to install the Multilib versions of GCC (and G++ if you want to) so that you can properly build and run 32-bit applications on 64-bit Ubuntu using the appropriate C libraries. That can be done with this command line:
On other non-Ubuntu Debian based systems you'd need to use: