Discussion:
Compiling C++11 with r14b: 'vector' file not found
Andreas Falkenhahn
2018-03-25 15:53:04 UTC
Permalink
I'm trying to compile some C++11 code with the clang that came with NDK r14b. I'm not using Android Studio, Gradle, or CMake but just plain makefiles.

I invoke clang like this:

C:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe --target=aarch64-none-linux-android --gcc-toolchain=C:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64 --sysroot=C:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/platforms/android-21/arch-arm64 -c -Wall -DANDROID -DNDEBUG -std=c++11 -O2 test.cpp

Note that I have set -std=c++11 so C++11 should work fine. Instead, the compiler errors after the very first line...

#include <vector>

...saying that it cannot find file "vector". What am I doing wrong?
--
Best regards,
Andreas Falkenhahn mailto:***@falkenhahn.com
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/1998855825.20180325175304%40falkenhahn.com.
For more options, visit https://groups.google.com/d/optout.
Andreas Falkenhahn
2018-03-26 12:00:45 UTC
Permalink
To answer my own question I had to pass -IC:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include

Strange that this isn't done automatically when passing -stdlib=libc++...
Post by Andreas Falkenhahn
I'm trying to compile some C++11 code with the clang that came with
NDK r14b. I'm not using Android Studio, Gradle, or CMake but just plain makefiles.
C:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
--target=aarch64-none-linux-android
--gcc-toolchain=C:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64
--sysroot=C:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/platforms/android-21/arch-arm64
-c -Wall -DANDROID -DNDEBUG -std=c++11 -O2 test.cpp
Note that I have set -std=c++11 so C++11 should work fine. Instead,
the compiler errors after the very first line...
#include <vector>
...saying that it cannot find file "vector". What am I doing wrong?
--
Best regards,
--
Best regards,
Andreas Falkenhahn mailto:***@falkenhahn.com
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/686035112.20180326140045%40falkenhahn.com.
For more options, visit https://groups.google.com/d/optout.
'Dan Albert' via android-ndk
2018-03-26 22:52:52 UTC
Permalink
Save yourself some trouble and let us do the work for you:
https://developer.android.com/ndk/guides/standalone_toolchain.html. There's
a section at the bottom about how to integrate it into an arbitrary
make/autoconf project.
Post by Andreas Falkenhahn
To answer my own question I had to pass
-IC:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include
Strange that this isn't done automatically when passing -stdlib=libc++...
Post by Andreas Falkenhahn
I'm trying to compile some C++11 code with the clang that came with
NDK r14b. I'm not using Android Studio, Gradle, or CMake but just plain
makefiles.
C:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
Post by Andreas Falkenhahn
--target=aarch64-none-linux-android
--gcc-toolchain=C:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64
--sysroot=C:/Users/foo/AppData/Local/Android/sdk/ndk-bundle/platforms/android-21/arch-arm64
Post by Andreas Falkenhahn
-c -Wall -DANDROID -DNDEBUG -std=c++11 -O2 test.cpp
Note that I have set -std=c++11 so C++11 should work fine. Instead,
the compiler errors after the very first line...
#include <vector>
...saying that it cannot find file "vector". What am I doing wrong?
--
Best regards,
--
Best regards,
--
You received this message because you are subscribed to the Google Groups
"android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-ndk/686035112.20180326140045%40falkenhahn.com
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAFVaGhtFP0LzFb8W1i-eB7KfO0V4uaap5xFTLhcPiv%3DOfEJNVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Andreas Falkenhahn
2018-03-27 09:37:55 UTC
Permalink
Post by 'Dan Albert' via android-ndk
https://developer.android.com/ndk/guides/standalone_toolchain.html.
There's a section at the bottom about how to integrate it into an arbitrary make/autoconf project.
Oh, great, I didn't know about that one. Certainly saves me the
hassle of having to crawl through the build files of a test
project to find out the build parameters. Thanks for the tip!
--
Best regards,
Andreas Falkenhahn mailto:***@falkenhahn.com
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/195274383.20180327113755%40falkenhahn.com.
For more options, visit https://groups.google.com/d/optout.
Loading...