[英]GCC: i386 architecture of input file `../window.ui.o' is incompatible with i386:x86-64 output
I'm trying to embed a file called window.ui
into my C executable, with the goal to access the contents later from within the code: 我试图将一个名为window.ui
的文件嵌入到我的C可执行文件中,目的是以后从代码中访问内容:
objcopy --input binary \
--output elf32-i386 \
--binary-architecture i386 ../src/window.ui ../window.ui.o
gcc `pkg-config --cflags gtk+-3.0` \
../src/*.c \
../*.o \
`pkg-config --libs gtk+-3.0` \
-o ../a.out
When compiling, GCC fails with the following error: 编译时,GCC失败,并出现以下错误:
/usr/bin/x86_64-linux-gnu-ld: i386 architecture of input file `../window.ui.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
Is there any way to force GCC to still include the file? 有什么方法可以强制GCC仍然包含该文件?
I've also tried the objcopy
with --output elf64-x86-64
, and this compiles correctly however the contents are garbled up when reading. 我也用--output elf64-x86-64
尝试了objcopy
,它可以正确编译, 但是读取时内容乱码了。
"solved" by using gnu-ld instead: 通过使用gnu-ld来“解决”:
ld -r -b binary ../src/window.ui -o ../window.ui.o
Couldn't figure out why objcopy
didn't work though. 无法弄清楚为什么objcopy
无法正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.