简体   繁体   English

Android ndk发出socket和std问题

[英]Android ndk issues socket and std issues

I am trying to compile my socket lib for the NDK and I am getting the following two errors: 我正在尝试为NDK编译我的套接字库,我收到以下两个错误:

error: 'close' was not declared in this scope

AND

error: 'min' is not a member of 'std'

I have followed the steps outlined HERE to fix the latter to no avail and I am not sure about the first. 我按照这里概述的步骤来修复后者无济于事,我不确定第一个。 Ive imported the following libs: 我已经导入了以下库:

#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>

Can ANYONE help me? 谁能帮我? I'm slowly losing my mind. 我慢慢失去理智。 Each build error I fix, more seem to appear. 我修复的每个构建错误,似乎都出现了。 I am SO close to getting this to work..... 我很接近让这个工作.....

Also, I HAVE read the relevant ndk docs. 另外,我已经阅读了相关的ndk文档。 Ive tried both gnustl_shared and stlport_shared as the APP_STL: value in my Application.mk file. 我已经尝试将gnustl_shared和stlport_shared作为我的Application.mk文件中的APP_STL:值。

Just as a reference, you can get the source code HERE 作为参考,您可以在这里获取源代码

std::min requires #include <algorithm> . std::min需要#include <algorithm> close requires #include <unistd.h> . close需要#include <unistd.h>

When you get an error like this, check the documentation for the function and see what header file(s) it requires. 当您收到类似这样的错误时,请检查该函数的文档并查看它所需的头文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM