0

I'm working with a cross-platform C++ project on Windows and MacOS. Due to cross-compatibility, I use the flag: -fshort-wchar in Xcode to ensure using 2 bytes instead of 4 bytes for a wide char as it is on the Windows platform. Now comes the problem.
Using Xcode 9.2 and below works fine with the flag but after updating to Xcode 9.3 or 9.4 I get Linker Error.

LLVM ERROR:

Function Import: link error
clang: error: linker command failed with exit code 1 (use -v to see invocation)

If I remove -fshort-wchar it compiles but then I get a runtime error due to using 4 byte wide chars when the code expects 2 byte.

-fshort-wchar is under Apple LLVM 9.0 Custom Compiler Flags -> Other C++ Flags

Any ideas?

4
  • I suspect this is another "unresolved external symbol" kind of error. Do you link against anything that may use 4-byte wide chars? Commented Jul 27, 2018 at 20:27
  • I use fmod, libz and libcurl. How do I know if some of them uses 4 byte wchars? The same lib files works in Xcode 9.2 though. Commented Jul 27, 2018 at 20:47
  • 1
    Is that the only error? Have you tried checking the buildtime logs for only errors as described here: stackoverflow.com/questions/18039197/… I usually find that if there a "linker command failed" there is another error you're not seeing and showing only errors helps. Commented Jul 27, 2018 at 20:56
  • No thats the only error Commented Jul 30, 2018 at 16:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.