0

I am trying to compile my socket lib for the NDK and I am getting the following two errors:

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. Ive tried both gnustl_shared and stlport_shared as the APP_STL: value in my Application.mk file.

Just as a reference, you can get the source code HERE

Community
  • 1
  • 1
Nicholas Terry
  • 1,812
  • 24
  • 40

1 Answers1

2

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

When you get an error like this, check the documentation for the function and see what header file(s) it requires.

David Schwartz
  • 179,497
  • 17
  • 214
  • 278
  • I have read the docs. I may not have read the right doc in the docs/ dir though... In either case, THANKS!!!!! You are my hero! Worked like a charm. – Nicholas Terry Jul 16 '12 at 01:23