Linker "undefined reference" errors with ofxDatGui addon in Android Studio?

#1

So, I’m trying to move a working OF project that uses ofxDatGui from Windows to Android Studio.

(The first thing I ran into was a need to make conditional some calls to GL (since ofxDatGui only #includes their headers conditionally, for Windows. But I seem to have fixed that.)

What I’m seeing now is linker errors trying to lin the base ofxDatGui object, like these:

C:\OF0.10.0And\apps\myApps\AnOFProject\src\Pages/modeFutureDay.cpp:458: error: undefined reference to ‘ofxDatGui::addDropdown(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator >, std::__ndk1::vector<std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator >, std::__ndk1::allocator<std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > > >)’
C:\OF0.10.0And\apps\myApps\AnOFProject…\addons\ofxDatGui/libs…/components/…/core/…/themes/ofxDatGuiTheme.h:0: error: undefined reference to ‘ofxDatGuiTheme::AssetPath’

Which is about a static class member ofxDatGuiTheme::AssetPath - that class doesn’t have its own .cpp file, and that static member is initialized in another .cpp file (ofxDatGuiComponent.cpp, which is in another subfolder of ofxDatGui).

So my guess is that Android Studio is not linking that other .cpp file… for some reason. But I do not understand how Android Studio is choosing which files to link and compile. Gradle, somehow. I did run the projectGenerator and it does seem to be compiling everything all right now - it’s just failing to link, just this one element?

I tried to figure out how to tell Android Studio to be sure to include that .cpp file in the project so it will link… but the documentation for adding C++ files to an Android Studio project do not match the UI of Android Studio 3.3 or 3.5 (both of which I have tried - same results) and there also seems to be no working way I could find to add a C++ file to the project using the UI - it looks like there is, but then the OK button to actually do it is disabled!

Any idea what I can do to get around this?

I’m down to considering just moving the whole addon into the project…

#2

Well, I still don’t understand what I was “supposed” to do to get ofxDatGui to link in Android Studio. Some Gradle thing?

But it DID work to move the entire addon into my project directory, and then patch up some paths in #include files inside it.

So it is possible to get ofxDatGui to build (and run correctly) on Android… but I’d really like to know what needs to be done to get it to work from the addons folder.