gpt4 book ai didi

c++ - libpng |建筑的重复符号

转载 作者:行者123 更新时间:2023-11-30 02:37:06 24 4
gpt4 key购买 nike

我正在尝试在 Mac OS X Yosemite 上使用 libpng 编译一个项目。

我得到了错误:

Undefined symbols for architecture x86_64:
"_png_create_info_struct", referenced from:
_writePNG in qrenc.o
"_png_create_write_struct", referenced from:
_writePNG in qrenc.o
"_png_destroy_write_struct", referenced from:
_writePNG in qrenc.o
"_png_init_io", referenced from:
_writePNG in qrenc.o
"_png_set_IHDR", referenced from:
_writePNG in qrenc.o
"_png_set_PLTE", referenced from:
_writePNG in qrenc.o
"_png_set_longjmp_fn", referenced from:
_writePNG in qrenc.o
"_png_set_pHYs", referenced from:
_writePNG in qrenc.o
"_png_set_tRNS", referenced from:
_writePNG in qrenc.o
"_png_write_end", referenced from:
_writePNG in qrenc.o
"_png_write_info", referenced from:
_writePNG in qrenc.o
"_png_write_row", referenced from:
_writePNG in qrenc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

所以我在 ld 调用中添加了 -lpng。现在它抛出

duplicate symbol _main in:
.obj/main.o
.obj/qrenc.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

链接自制软件安装的 libpng 时出现同样的错误。

我做错了什么?

最佳答案

您有两个具有主要功能的文件(可能是 main.c 和 qrenc.c)。从这些文件中删除函数并使用 -lpng。

关于c++ - libpng |建筑的重复符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32026711/

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