error: conditional compilation flags must be valid Swift identifiers (rather than '-sdk')

I'm trying to add the Intents Extension to my app (Xcode 10.1) that use Swift 4 and CocoaPods.


After I added the Intents Extension and embedded into my target (I have a couple of targets), I tried to build and got the following error:


CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
  cd /Users/USER/iOS
  export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
  export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
  export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name MyApp_Intents -Onone -enable-batch-mode -enforce-exclusivity=checked -DDEBUG -Onone -enable-bridging-pch -DDEBUG -D -sdk
...
:0: error: conditional compilation flags must be valid Swift identifiers (rather than '-sdk')
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1


This are my values for Other Swift Flags:

-Onone -enable-bridging-pch -DDEBUG -D

I've looked to similar issues, but in my case, the compiler is complaining about a "-sdk" value that I cannot found, I even tried to remove some values (and in a moment of despair, all) from Other Swift Flags, but unfortunately, when I remove them, a "Macro name must be an identifier swift" error appears.


Anyone on this?

Replies

Why do you put `-D` at the last of your Other Swift Flags? `-D` is an option that consumes the next argument as the defined symbol.

It is not clear enough what you have tried, but at least you need to remove it.