Skip to content

Compile error when using clang and precompiled headers #16

Closed

Description

@DoDoENT

In my Application.mk I've set NDK_TOOLCHAIN_VERSION=clang and in Android.mk I've defined LOCAL_PCH to point header I wish to get precompiled.

With GCC (NDK_TOOLCHAIN_VERSION unset), project can be built successfully. With clang I get following errors:

clang++: error: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated

Activity

  1. DoDoENT commented on Mar 14, 2016

    @DoDoENT
    Author

    It appears this can be fixed by adding following line to $NDK_DIR/build/core/build-binary.mk:

    Around line 440, below comment #Build PCH and above $(call compile-cpp-source,$(LOCAL_PCH),$(LOCAL_BUILT_PCH).gch) add this line:

    LOCAL_SRC_FILES_TARGET_CFLAGS.$(LOCAL_PCH) += -x c++-header

  2. DanAlbert commented on Mar 14, 2016

    @DanAlbert
    Contributor
  3. self-assigned this
    on Mar 14, 2016
  4. added this to the r12 milestone on Mar 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions