0

What I am trying to do is take a bunch of .C files that I created using f2c.exe on a Windows computer and use them in Xcode in an already existing project consisting primarily of Swift code.

On my Windows computer I used f2c to generate the .C files and then was able to build them to an executable and it runs as expected. So I took all of the .C files and brought them to my Xcode project and that is where I am currently stuck.

I only just added in the .C files and Xcode gives the following errors when I try to buid:

Undefined symbols for architecture arm64:
  "_s_wsle", referenced from:
      _xplannr_ in X1.o

      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

X1.C is one of the .C files I have as an example. Additionally there are many repeated messages, I have just shown 1 for the purpose of this question. They all follow the same format as what I have provided here.

So what I am trying to understand is, what does the error message that is being provided indicating? Is this an issue of how the .C files were generated, or some configuration issue within Xcode that is not correct? Any ideas are appreciated.

Paul Sanders
  • 24,133
  • 4
  • 26
  • 48
ez4nick
  • 9,756
  • 12
  • 37
  • 69
  • What is `s_wsle`? The error indicates that the linker is unable to find it. Difficult to help beyond that as you have not provided the code. Please provide a [mre]. – kaylum May 24 '22 at 23:10
  • 1
    https://stackoverflow.com/questions/50878209/error-in-a-c-code-which-is-translated-from-fortran-using-a-f2c - first hit on Google. Also, I added the obvious tag. – Paul Sanders May 24 '22 at 23:41
  • 1
    Does this answer your question? [Error in a C code which is translated from Fortran using a f2c](https://stackoverflow.com/questions/50878209/error-in-a-c-code-which-is-translated-from-fortran-using-a-f2c) – Paul Sanders May 24 '22 at 23:41
  • 1
    @PaulSanders I think you may be on to something there. So when I compiled on Windows I know I had to link to the `libf2c.lib` library. So seems like I have to make `libf2c.a` on Mac and then get that to compile with my Xcode project. Will try that tomorrow and report back. Thanks for finding that question. – ez4nick May 25 '22 at 00:17
  • you are missing f2c library – 0___________ May 25 '22 at 00:44
  • So I was able to get a `libf2c.a` file and put it in my xcode project. But I am still getting the same errors. I added the file in Targets->Build phases->Link binary with libraries and added the path to Build Settings->Search Paths->Library search paths. Is there anything else I am missing to get it to compile? – ez4nick May 25 '22 at 16:55
  • The new question that you asked indicates that the `libf2c.a` file that you found was for an `x86` architecture. And that means it's either for Windows-x85 or MacOS-x86. There's no chance that's going to work on iOS-arm64. You either need to find the library that was specifically built for iOS-arm64, or you need to download the source code for the library, and rebuild the library yourself. And that's only going to work if the library has been ported to iOS-arm64. – user3386109 May 27 '22 at 16:33

0 Answers0