CPP files don't get compiled
See original GitHub issueThere is a problem with compiling the C code.
When adding this entry in grade build:
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
And syncing gradle I get this error message:
Gradle project cmake.path is /Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt but that file doesn't exist
Gradle project cmake.path is /Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt but that file doesn't exist
Gradle project cmake.path is /Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt but that file doesn't exist
Gradle project cmake.path is /Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt but that file doesn't exist
Gradle project cmake.path is /Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt but that file doesn't exist
Gradle project cmake.path is /Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt but that file doesn't exist
Gradle project cmake.path is /Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt but that file doesn't exist
Gradle project cmake.path is /Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt but that file doesn't exist
/Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt : C/C++ debug|x86 : Failed to activate protocol version: "CMAKE_HOME_DIRECTORY" is set but incompatible with configured source directory value.
/Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt : C/C++ debug|x86 : Waiting for type "handshake".
executing external native build for cmake /Users/houmie/projects/t-android/app/src/main/cpp/CMakeLists.txt
I went then ahead and created the cpp
directory and placed an empty text file called CMakeLists.txt
.
Then I could sync the gradle.
Then I ran:
./gradlew hideSecret -Pkey=Houmie -PkeyName=YourSecretKeyName
It creates four files under cpp
folder. secrets.cpp, sha256.cpp + headers. Secrets
is also generated for Kotlin.
So far so good, but when I run it in the project:
val key = Secrets().getYourSecretKeyName(packageName)
It crashes:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libsecrets.so" not found
It hasn’t built it. What am I missing please? Thank you
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
G++ Not Finding Included .cpp Files When Compiling
Also, you do not usually include .cpp files, you pass them as separate arguments to the compiler and then combine them using the...
Read more >Only my main.cpp gets compiled - general solution by editing ...
I use visual studio code with the "C/C++" extension and installed Mingw-w64 as compiler. Regardless of the Project (more than one .cpp file) ......
Read more >Multi-file projects
Don't ever #include .cpp files. Instead, compile them with G++ and link them together. If you #include a .cpp ...
Read more >C++ Separate Header and Implementation Files
C++ classes (and often function prototypes) are normally split up into two files. The header file has the extension of .h and contains...
Read more >Multiple File Compilation - Computer Science, FSU
Changes to a file require only that file to be re-compiled (rather than everything), along with the re-linking; Often, libraries are distributed in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ben-j69 I just tested it again. I deleted the cpp folder and ran
./gradlew hideSecret
. And it syncs the files over. You were right.The steps you mentioned is correct. Yesterday I had mistakenly added
externalNativeBuild
in gradle before running./gradlew hideSecret
. This caused the issue. So the documentation is correct, I didn’t pay enough attention. 😃Thank you for recommending Cocopods Keys, I will try it out.
@houmie thanks for your feedback.