Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error when using clang and precompiled headers #16

Closed
DoDoENT opened this issue Mar 14, 2016 · 2 comments
Closed

Compile error when using clang and precompiled headers #16

DoDoENT opened this issue Mar 14, 2016 · 2 comments
Assignees
Milestone

Comments

@DoDoENT
Copy link

DoDoENT commented Mar 14, 2016

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
@DoDoENT
Copy link
Author

DoDoENT commented Mar 14, 2016

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

@DanAlbert
Copy link
Member

Thanks again! Added a test case and uploaded for review: https://android-review.googlesource.com/208223

@DanAlbert DanAlbert self-assigned this Mar 14, 2016
@DanAlbert DanAlbert added this to the r12 milestone Mar 14, 2016
DanAlbert added a commit that referenced this issue Apr 16, 2016
Clang whines about a "c-header" (.h rather than .hpp) being used in
C++ mode (note that we use compile-cpp-source to build the header).
Tell clang that we're building it as C++.

Patch contributed by @DoDoENT.

Bug: #16
Change-Id: I50803003394f28cf4f92faef13cd6ed680cbf77c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants