gpt4 book ai didi

c - 编译具有多个头文件的C程序时出错

转载 作者:行者123 更新时间:2023-11-30 16:45:48 24 4
gpt4 key购买 nike

我有kmeans_seq.cbikmeans_seq.c文件。文件bikmeans_seq.c包括两个 header :kmeans_seq.hbikmeans_seq.h 。当我编译bikmeans_seq.c时使用gcc bikmeans_seq.c -o bikmeans我收到此错误:

Undefined symbols for architecture x86_64:
"_euclidean_dist", referenced from:
_points_assignment in bikmeans_seq-5c462b.o
_partition_clusters in bikmeans_seq-5c462b.o
_standard_deviation in bikmeans_seq-5c462b.o
"_find_max", referenced from:
_standard_deviation in bikmeans_seq-5c462b.o
"_kmeans", referenced from:
_main in bikmeans_seq-5c462b.o
_partition_clusters in bikmeans_seq-5c462b.o
(maybe you meant: _bisecting_kmeans)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我不确定这个错误是什么。有人可以提示我为什么会收到此错误吗?谢谢。

最佳答案

没有来源有点困难,但试试这个:

gcc -Wall bikmeans_seq.c kmeans_seq.c -o bikmeans

即使这可行,我也建议使用 makefile。

希望这有帮助!

关于c - 编译具有多个头文件的C程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43979176/

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