I am working on a Visual Studio Mobile development project using the Basic Application (Android, Gradle) template but I modified the main file to be a C++ file instead of Java. Here is my Project structure:
VSProject
├─VSProject.sln
├─VSProject.sln.DotSettings.user
└─VSProject
├── VSProject.androidproj
├── VSProject.androidproj.user
├── app
│ ├── build.gradle
│ └── src
│ └── main
│ ├── AndroidManifest.xml
│ └── cpp
│ ├── CMakeLists.txt
│ ├── app_framework
│ └── main.cpp
├── build.gradle
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradle.properties
├── gradlew.bat
└── settings.gradle
My main.cpp starts by including some headers that are necessary for the file to compile, but in the Visual Studio Android,Gradle template there is no "Additional Include Directories" entry in Project->Properties.
Here are my includes:
#include <app_framework/application.h>
#include <gflags/gflags.h>
#include <test_audio.h>
#include <algorithm>
#include <fstream>
#include <limits>
#include <vector>
None of these files is found in the search paths and hence none is included. "app_framework" is a local directory (same location as main.cpp), so I fixed it by simply doing:
#include "app_framework/application.h"
The others are more problematic: "gflags" is a sub folder to "app_framework" and I would like to avoid having to write down the whole path to "gflags" as it is fairly long. "test_audio.h" is an external file to my solution. Same for "algorithm", "fstream", "limits" and "vector". I am trying to find a way to do what I usually do in a C++ application template in Visual Studio through "Additional Include Directories" in the Gradle template in VS but I do not know how to do so. Where can I set the search include paths to find the files and have the main.cpp compile?
When I build the solution, the .apk application is correctly created and installed on the device, but it does not run due to the main.cpp file not including those files. I am using Gradle 7.5.1.