我对OSX狮子构建文件
VPATH = src include
CFLAGS ="-I include -std=gnu99"
hello: hello.o
gcc $^ -o $@
hello.o: hello.h hello.c
gcc $(CFLAGS) -c $< -o $@
但是,当我尝试运行这个make文件我得到以下错误
ld: warning: ignoring file hello.o, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
我已经使用标志尝试-arch x86_64
,但仍然得到同样的错误。
运行arch
命令给出: i386
。
uname -a
告诉我: Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64
Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64
我也尝试添加开关-march=x86-64
在这个答案说明是专为i386的文件,该文件是不是被链接下(x86_64)架构,而在Mac OSX 10.6编译OpenCV2.2为iOS 4.2 ,但是这不是招“T为我工作。
在命令行的输出是:
gcc -I include -std=gnu99 -m64 -c include/hello.h -o hello.o
gcc -I include -std=gnu99 -m64 hello.o -o hello
ld: warning: ignoring file hello.o, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [hello] Error 1