0

I'm trying to compile a C program to be called from the Prolog Foreign Function Interface. I'm doing some Dynamic Programming, which isn't exactly efficient in Prolog. However, when I try to compile my file, I get the following error:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
      start in crt1.10.6.o
     (maybe you meant: __main)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/Developer/usr/bin/clang returned code 256
*** swipl-ld exit status 1

The C file is simply the example found here.

Does anybody know if there is a way to fix this?

jmite
  • 8,171
  • 6
  • 40
  • 81

1 Answers1

1

It sounds like you are trying to link as an executable rather than a library (.dylib).

Using XCode you should create your project as a Dynamic C/C++ library.

Nick Main
  • 1,440
  • 8
  • 15