我正在 Android Studio 中编写一些 JNI 代码,但在 IDE 中一遍又一遍地遇到相同的错误:
parameter type mismatch: array is not assignable
总是有类似的情况,像这样:
void testB(uint8_t buff[4]) {
//some code
}
void testA() {
uint8_t buff[4] = { 0, 1, 2, 3 };
testB(buff); //buff is underlined red and says: parameter type mismatch: array is not assignable
}
所以在 testB(buff)
行上 buff 带有红色下划线,并在悬停时显示上述错误
代码编译并运行良好。这是 IDE 中的错误,还是我在这里做错了什么?我可以摆脱这个烦人的错误吗?
更新:我从评论中得到了答案。感谢 Ian Abbott、Lundin 和 juanchopanza! 我会等一会儿有人写出一个全面的答案,如果没有出现,我会在稍后使用这些评论作为基础来回答这个问题并完成。
最佳答案
您忘记了结束 }
后的分号。编译器只是继续执行,并在一段时间后当它感到困惑时报告错误:
void testA() {
uint8_t buff[4] = { 0, 1, 2, 3 }; // semi-colon here
testB(buff);
}
关于android - 为什么IDE显示: parameter type mismatch: array is not assignable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35292030/