E:\android\SDK\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --sysroot=E:/android/SDK/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dprac071301_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++11 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/prac071301.dir/native-lib.cpp.o -MF CMakeFiles\prac071301.dir\native-lib.cpp.o.d -o CMakeFiles/prac071301.dir/native-lib.cpp.o -c "F:/android studio project/prac071301/app/src/main/cpp/native-lib.cpp" F:/android studio project/prac071301/app/src/main/cpp/native-lib.cpp:28:31: error: too few arguments to function call, expected 2, have 1 env->NewString("���Ϻ�"); ~~~~~~~~~~~~~~ ^ E:/android/SDK/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/jni.h:827:13: note: 'NewString' declared here jstring NewString(const jchar* unicodeChars, jsize len) ^
时间: 2023-12-27 13:04:57 浏览: 67
这个错误提示是因为`NewString`函数需要两个参数,但是你只传递了一个参数。正确的调用方式应该是`env->NewString(unicodeChars, len)`,其中`unicodeChars`是一个`jchar`类型的数组,`len`是数组的长度。你需要检查一下你的代码,确保传递了正确的参数。
相关问题
The C compiler ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe" is not able to compile a simple test program.
This could be due to various reasons, such as incorrect configuration of the compiler, missing dependencies, or issues with the code being compiled. Some possible solutions are:
1. Check the configuration of the C compiler and make sure it is set up correctly. This may involve setting environment variables, specifying library paths, or installing additional packages.
2. Ensure that all necessary dependencies are installed, including any required libraries, header files, or other components.
3. Check the code being compiled for errors or syntax issues. Fix any errors or warnings that are reported, and make sure that the code is compatible with the version of the C compiler being used.
4. Try using a different C compiler or toolchain to see if the issue persists. This may involve installing a different version of the NDK or using a different compiler altogether.
5. Consult the documentation or community forums for the C compiler or SDK being used for further troubleshooting tips and solutions.
Execution failed for task ':app:externalNativeBuildDebug'. > Build command failed. Error while executing process D:\NDK\android-sdk-windows\cmake\3.22.1\bin\ninja.exe with arguments {-C E:\desktop\MyApplication\app\.cxx\cmake\debug\armeabi-v7a myapplication} ninja: Entering directory `E:\desktop\MyApplication\app\.cxx\cmake\debug\armeabi-v7a' [1/2] Building CXX object CMakeFiles/myapplication.dir/native-lib.cpp.o FAILED: CMakeFiles/myapplication.dir/native-lib.cpp.o D:\NDK\android-sdk-windows\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi24 --gcc-toolchain=D:/NDK/android-sdk-windows/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/NDK/android-sdk-windows/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dmyapplication_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/myapplication.dir/native-lib.cpp.o -MF CMakeFiles\myapplication.dir\native-lib.cpp.o.d -o CMakeFiles/myapplication.dir/native-lib.cpp.o -c E:/desktop/MyApplication/app/src/main/cpp/native-lib.cpp E:/desktop/MyApplication/app/src/main/cpp/native-lib.cpp:3:10: fatal error: 'opencv2/core.hpp' file not found #include <opencv2/core.hpp> ^~~~~~~~~~~~~~~~~~ 1 error generated. ninja: build stopped: subcommand failed. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights.
这个错误提示是说在编译过程中找不到OpenCV库的头文件"opencv2/core.hpp",你需要确认你的OpenCV库是否已经正确地导入到项目中,并且在CMakeLists.txt中正确地配置了OpenCV库的路径。你可以尝试使用下面的命令来查找OpenCV库的位置:
```shell
find_package(OpenCV REQUIRED)
message("OpenCV library status:")
message(" version: ${OpenCV_VERSION}")
message(" libraries: ${OpenCV_LIBS}")
message(" include path: ${OpenCV_INCLUDE_DIRS}")
```
如果你已经正确导入了OpenCV库并且配置了路径,那么你可以尝试使用Android Studio的Clean Project和Rebuild Project选项来重新编译项目。如果还是无法解决问题,你可以尝试查看编译日志以获取更多的信息。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)