Skip to content

Xcode 12 warnings about quoted includes #433

Closed

Description

@LeoNatan

Xcode 12 introduces a new warning, -Wquoted-include-in-framework-header, which makes it impossible to compile Core Plot.

Core Plot should ideally move to #import <CorePlot/header.h> imports, or at least disable this warning in the project settings.

Thanks

Activity

  1. eskroch commented on Jun 28, 2020

    @eskroch
    Member

    This warning is disabled via .xcconfig file when using the Core Plot project. The top-level header files do use fully qualified framework references. We can't change the includes in each CPT* file because one of the supported configurations is an iOS static library. The framework references don't make sense in that context.

    Are you using CocoaPods? If that's the problem, we can add the warning setting to the podspec.

  2. LeoNatan commented on Jun 28, 2020

    @LeoNatan
    Author

    Hello,

    I have the project as a submodule in my project, and I am building the macOS framework using the following command:

    xcodebuild -project "core-plot/framework/CorePlot.xcodeproj" -scheme "CorePlot Mac" -configuration Release build
    

    I then link against the resulting .framework in my project:

    Screen Shot 2020-06-28 at 16 59 00

    The problem is, when importing a header file from Core Plot, my project fails (I have treat warnings as errors enabled). I would like to keep the warning on for my project, but that makes it impossible to build the project.

    If you absolutely must keep the includes as is—and you don't—you should use the following syntax for including:

    #if __has_include(<Module/Header.h>)
    #import <Module/Header.h>
    #else
    #import "Header.h"
    #endif
    

    But I don't think it is necessary. For a static framework, you can specify where the header files should be installed when building, so that the <Module/Header.h> syntax works as expected.

    To do this, you add a header phase (like in the dynamic framework target), define public and private headers, and then set the Public Headers Folder Path setting to include/$(PROJECT_NAME). (See here). After this step, #import <Module/Header.h> should work for static framework as well.

    Otherwise, the project can no longer be used if users want to enable the Xcode 12 warning.

  3. eskroch commented on Jun 28, 2020

    @eskroch
    Member

    We already provide an iOS framework, too. It may be time to retire the static library option. That's a legacy from early in iOS history when it didn't support user frameworks.

  4. LeoNatan commented on Jun 28, 2020

    @LeoNatan
    Author

    If the framework targets iOS 8 or above, there really is no need for a static library really.

  5. eskroch commented on Jul 6, 2020

    @eskroch
    Member

    I created a Twitter poll to see if there's any opposition to removing the static library. The poll is open until July 9, 2020. Please vote.

  6. self-assigned this
    on Jul 12, 2020
  7. added this to the Release 2.4 milestone on Jul 12, 2020
  8. eskroch commented on Jul 12, 2020

    @eskroch
    Member

    The poll result is unanimous—it's time to remove the static library. I'll do this for the 2.4 release.

  9. LeoNatan commented on Jul 12, 2020

    @LeoNatan
    Author

    Thank you for the update!

  10. lexuanquynh commented on Oct 1, 2020

    @lexuanquynh

    I got the same issue. How to fix:

    • Go to Build Settings -> delete bold line at Build active Architecture Only. It will change to default setting.
  11. DivineDominion commented on Jan 22, 2021

    @DivineDominion
    Contributor

    Using Xcode 12.3, I cannot reproduce any build errors. Not even warnings (except for a known problem with unit tests: ld: warning: dylib (/Applications/Xcode123.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework/XCTest) was built for newer macOS version (10.15) than being linked (10.10))

    Using release-2.4 branch. Master works fine as well. Am on Catalina, could that be it?

  12. altimac commented on Oct 13, 2022

    @altimac
    Contributor

    AFAIK this problem is still not fixed in release-2.4. I had to disable -Wquoted-include-in-framework-header in my master project to build the dynamic iOS framework.

  13. jayMcBee commented on Feb 3, 2023

    @jayMcBee

    No need to disable the warning for the entire project -
    just disable the warning locally in the relevant files (e.g. in the view importing CorePlot) via

     #pragma GCC diagnostic ignored "-Wquoted-include-in-framework-header"
     #import <CorePlot/CorePlot.h>
    
  14. eskroch commented on Apr 9, 2023

    @eskroch
    Member

    This should be fixed on the release-2.4 branch. Let me know if anyone is still seeing this issue with the latest code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions