0

I have kmeans_seq.c and bikmeans_seq.c files. The file bikmeans_seq.c includes two headers: kmeans_seq.h and bikmeans_seq.h. When I compile bikmeans_seq.c using gcc bikmeans_seq.c -o bikmeans I get this error:

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)

I am not sure what this error is. Can someone hint me why I am getting this error? Thank you.

Toby
  • 9,696
  • 16
  • 68
  • 132
A_D
  • 595
  • 1
  • 5
  • 12

1 Answers1

0

Without sources is a bit difficult but try this:

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

Even if this will work I would suggest to use a makefile.

Hope this helps!

Simone Cifani
  • 784
  • 4
  • 14
  • I think the OP is using clang, according to this line of the output shown `clang: error: linker command failed with exit code 1 (use -v to see invocation)` – Toby May 15 '17 at 12:18
  • 1
    @Toby In the question he wrote "When I compile bikmeans_seq.c using gcc bikmeans_seq.c -o bikmeans I get this error", but I had the same doubt – Simone Cifani May 15 '17 at 12:35
  • 1
    Must be an Apple system. They messed things up completely when they moved from gcc to clang but linked `gcc` to clang. 80% of Apple users now think they use gcc. – too honest for this site May 15 '17 at 12:43