openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

Android studio not finding std c++ headers using ofxPoco

Open fred-dev opened this issue 3 years ago • 3 comments

I am working with the current master as of today and when I try to add ofxPoco to a project I get a lot of errors, mostly related to this:

 error: no type named 'string' in namespace 'std'
        Exception(const std::string& msg, int code = 0);

The compile stops as there are too many errors, but here is some more verbose output:

/Users/fredrodrigues/Library/Android/sdk/ndk/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/stdexcept:74:32: error: unknown type name 'string' explicit logic_error(const string&); ^ /Users/fredrodrigues/Library/Android/sdk/ndk/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/stdexcept:91:34: error: unknown type name 'string' explicit runtime_error(const string&); ^ /Users/fredrodrigues/Library/Android/sdk/ndk/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/stdexcept:106:59: error: unknown type name 'string' _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {} ^ /Users/fredrodrigues/Library/Android/sdk/ndk/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/stdexcept:116:63: error: unknown type name 'string' _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {} ^ /Users/fredrodrigues/Library/Android/sdk/ndk/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/stdexcept:126:59: error: unknown type name 'string' _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {} ^ /Users/fredrodrigues/Library/Android/sdk/ndk/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/stdexcept:136:59: error: unknown type name 'string' _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {} ^ /Users/fredrodrigues/Library/Android/sdk/ndk/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/stdexcept:146:58: error: unknown type name 'string' _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {} ^ /Users/fredrodrigues/Library/Android/sdk/ndk/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/stdexcept:156:61: error: unknown type name 'string' _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {} ^ /Users/fredrodrigues/Library/Android/sdk/ndk/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/stdexcept:166:62: error: unknown type name 'string' _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}

If I remove ofxPoco from my addons.mk file then I can compile and run the apps on my device or simulator.

I am using Android studio 3.14 and android-ndk-r15c as advised.

fred-dev avatar Feb 13 '22 01:02 fred-dev

I guess that the #include <string> is missing somewhere. It is quite odd though. is this error being thrown in the Poco files? cant you fix it just by putting #include <string> where needed?

roymacdonald avatar Feb 13 '22 05:02 roymacdonald

Adding #include <string> anywhere does not solve the issue.

fred-dev avatar Feb 14 '22 01:02 fred-dev

Just a bump on this after a little more digging. When the build variant is set to x86 using ofxPoco with openframeworks compiles perfectly on Android. Using any other build variant gives the errors I listed above.

fred-dev avatar Apr 12 '22 10:04 fred-dev