xcode clang: error: "cannot specify -o when generating multiple output files"

Hello

xcode clang: error: "cannot specify -o when generating multiple output files"

I don't think I should after updating Xcode 15.3, where should I check??

I used it well before.

Replies

It’s hard to offer insight here without more info. You’re building an Xcode project, right? From within the Xcode app? Or using xcodebuild?

Also, what type of target are you building?

And if you create a new project using the corresponding Xcode template, does it have the same problem?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • @eskimo We are making navigation apps and there are two projects. Both have engine part, one c based, the other c++ based. We don't know if c or c++ has something to do with this error, but only c++ project makes this errors. They are iPhone/iPad apps, and yes, they are XCode projects. Since it's a big project, we didn't try making a new project yet.

Add a Comment

@eskimo

Thank you for your response.

We are making navigation apps and there are two projects. Both have engine part, one c based, the other c++ based. We don't know if c or c++ has something to do with this error, but only c++ project makes this errors. They are iPhone/iPad apps, and yes, they are XCode projects. Since it's a big project, we didn't try making a new project yet.

My general approach for debugging such problems is to create a small test project using the same target type and language I’m working with. That way I can verify that things work in general. My experience is that, if such a test project fails with the same error, there’s an environmental issue in play.

Once you’ve confirmed that your environment is working correctly, it’s time to debug your main project. I use two standard approaches for this:

  • I look at the build log [1] for hints as to where this error is coming from.

  • I compare my working test project against my failing main project to see what’s different. If there’s nothing obvious, I add stuff to the test project and (temporarily) remove stuff from the main project until they start to look the same. It’s usually easiest to do this by removing stuff from the main project.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] To get that:

  1. Choose View > Navigators > Reports.

  2. Select a failed build on the left.

  3. Click the Export button, near the top right.

  • @eskimo My colleague replied something new, I'd appreciate it if you could check it.

Add a Comment

Hello, @eskimo ,

I am a colleague of @kimjitae .

Let me explain what happens. Sometimes, clang cannot process -o option and it gives the error, 'cannot specify -o when generating multiple output files'. However, when I remove the part after -o, it compiles the file alright. It seems that clang cannot process -o option properly in some circumstances, though I couldn't figure out why yet. (paths are edited)

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -ivfsstatcache /Users/me/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator17.4-21E210-aa93b11c43e2d16681ac3fa171344f4f.sdkstatcache -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fno-color-diagnostics -Wno-trigraphs -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -fstrict-aliasing -Wdeprecated-declarations -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -Wno-ambiguous-macro @/Users/me/Library/Developer/Xcode/DerivedData/project-cexwczazumtpztgpgzvhxojjgqab/Build/Intermediates.noindex/project.build/Release\ Device-iphonesimulator/NAVI\ 3.0.build/Objects-normal-asan/x86_64/7187679823f38a2a940e0043cdf9d637-common-args.resp -include /Users/me/navi3/navi-ios-3.0/NAVI3.0_WEU/NAVIPrefix.h -MMD -MT dependencies -MF /Users/me/Library/Developer/Xcode/DerivedData/project-cexwczazumtpztgpgzvhxojjgqab/Build/Intermediates.noindex/project.build/Release\ Device-iphonesimulator/NAVI\ 3.0.build/Objects-normal-asan/x86_64/zip.d --serialize-diagnostics /Users/me/Library/Developer/Xcode/DerivedData/project-cexwczazumtpztgpgzvhxojjgqab/Build/Intermediates.noindex/project.build/Release\ Device-iphonesimulator/NAVI\ 3.0.build/Objects-normal-asan/x86_64/zip.dia -c /Users/me/navi3/app-engine-3.0/Libraries/Util/ZipArchive/minizip/zip.c -o /Users/me/Library/Developer/Xcode/DerivedData/project-cexwczazumtpztgpgzvhxojjgqab/Build/Intermediates.noindex/project.build/Release\ Device-iphonesimulator/NAVI\ 3.0.build/Objects-normal-asan/x86_64/zip.o

  • FYI, I tried -o /Users/me/zip.o and it also failed.

Add a Comment