gpt4 book ai didi

c ) make error& link problem : i386:x86-64 architecture of input file, 与 i386 输出不兼容

转载 作者:太空狗 更新时间:2023-10-29 16:25:09 35 4
gpt4 key购买 nike

当我在终端中输入“make”时,我得到了带有错误消息的输出!!

gcc test1.o dispatchQueue.o -o test1 -pthread
/usr/bin/ld: i386:x86-64 architecture of input file `test1.o' is incompatible with i386 output
/usr/bin/ld: final link failed: Invalid operation
collect2: ld returned 1 exit status
make: *** [test1] Error 1

有没有人可以解释为什么以及如何解决它? :(

我附加了 makefile 以防万一

# Comment out the targets you don't want.

# Runs all of the tests.
all: test1 test2 test3 test4 test5 testFor
./test1
./test2
./test3
./test4
./test5
./testFor

test1: test1.o dispatchQueue.o
gcc test1.o dispatchQueue.o -o test1 -pthread

test1.o: test1.c
gcc -c test1.c

test2: test2.o dispatchQueue.o
gcc test2.o dispatchQueue.o -o test2 -pthread

test2.o: test2.c
gcc -c test2.c

test3: test3.o dispatchQueue.o
gcc test3.o dispatchQueue.o -o test3 -pthread

test3.o: test3.c
gcc -c test3.c

test4: test4.o dispatchQueue.o
gcc test4.o dispatchQueue.o -o test4 -pthread

test4.o: test4.c
gcc -c test4.c

test5: test5.o dispatchQueue.o
gcc test5.o dispatchQueue.o -o test5 -pthread

test5.o: test5.c
gcc -c test5.c

testFor: testFor.o dispatchQueue.o
gcc testFor.o dispatchQueue.o -o testFor -pthread

testFor.o: testFor.c
gcc -c testFor.c

dispatchQueue.o: dispatchQueue.c dispatchQueue.h
gcc -c dispatchQueue.c

最佳答案

您可能有一些为 i386-x64 编译的旧文件(至少是 test1.o)。您可以删除这些旧文件并再次运行 make。如果您可以修改 Makefile,请尝试添加一行,例如:

clean:
rm *.o test1 test2 test3 test4 test5 testFor

然后当您运行 make clean 时,它会删除旧的东西,此时您可以再次运行 make。

关于c ) make error& link problem : i386:x86-64 architecture of input file, 与 i386 输出不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7027018/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com