From: jamesromeongmail.com on
I am trying to make some code to test sockets that needs to work on
Windows, Macs and Linux. I am doing this on SUSE 10.3 with NetBeans
6.1RC1, but it uses plain old make and gcc.

So, the start of my code looks like:
-------------------------------
#define GPC_UNX

#ifdef GPC_WIN
#define JAVA_LOCATION "c:\\Program Files\\Java\\jre1.6.0_05\\bin\
\java"
#define TP_LOCATION "C:\\tekPlot\\dist\\tekPlot.jar"
#include <process.h>
#include <winsock2.h>
#include <time.h>
#endif

#ifdef GPC_UNX
#define JAVA_LOCATION "/usr/bin/java"
#define TP_LOCATION "~/Tekdraw2/tekPlot/dist/tekPlot.jar"
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif

// Include for all platforms
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <errno.h>

/*
*
*/
int
main(int argc, char** argv) {
FILE * fp;
int sd, ch, i, n, m;
struct sockaddr_in addr;
struct in_addr inputaddress;
char * portstr;
.. . . .
-------------------------------
But when I build it, I get:
-------------------------------
Running "/usr/bin/gmake -f Makefile CONF=Linux-debug" in /home/jar/
NetBeansProjects/trunk

/usr/bin/gmake -f nbproject/Makefile-Linux-debug.mk
SUBPROJECTS= .build-conf
gmake[1]: Entering directory `/home/jar/NetBeansProjects/trunk'
mkdir -p build/Linux-debug/GNU-Linux-x86/src
gcc -c -g -I/usr/include/netinet -I/usr/include -I/usr/include/sys -
I/usr/include/gnu -o build/Linux-debug/GNU-Linux-x86/src/tkfPusher.o
src/tkfPusher.c
In file included from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
........
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from src/tkfPusher.c:20:
/usr/include/sys/unistd.h:1:20: error: #include nested too deeply
In file included from /usr/include/sys/errno.h:1,
from /usr/include/sys/errno.h:1,
from /usr/include/sys/errno.h:1,
.. . . . .
from /usr/include/sys/errno.h:1,
from /usr/include/sys/errno.h:1,
from /usr/include/sys/errno.h:1,
from /usr/include/sys/errno.h:1,
from /usr/include/sys/errno.h:1,
from src/tkfPusher.c:30:
/usr/include/sys/errno.h:1:19: error: #include nested too deeply
src/tkfPusher.c: In function 'main':
----------------------------------------
How do I resolve these nesting errors?

Thanks,
Jim
From: jamesromeongmail.com on
On Apr 12, 4:17 pm, "jamesromeongmail.com" <jamesr...(a)gmail.com>
wrote:
> I am trying to make some code to test sockets that needs to work on
> Windows, Macs and Linux. I am doing this on SUSE 10.3 with NetBeans
> 6.1RC1, but it uses plain old make and gcc.
>
> So, the start of my code looks like:
> -------------------------------
> #define GPC_UNX
>
> #ifdef GPC_WIN
> #define JAVA_LOCATION "c:\\Program Files\\Java\\jre1.6.0_05\\bin\
> \java"
> #define TP_LOCATION "C:\\tekPlot\\dist\\tekPlot.jar"
> #include <process.h>
> #include <winsock2.h>
> #include <time.h>
> #endif
>
> #ifdef GPC_UNX
> #define JAVA_LOCATION "/usr/bin/java"
> #define TP_LOCATION "~/Tekdraw2/tekPlot/dist/tekPlot.jar"
> #include <unistd.h>
> #include <netdb.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
>
> // Include for all platforms
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/types.h>
> #include <errno.h>
>
> /*
>  *
>  */
> int
> main(int argc, char** argv) {
>    FILE * fp;
>    int sd, ch, i, n, m;
>    struct sockaddr_in addr;
>    struct in_addr inputaddress;
>    char * portstr;
> . . . .
> -------------------------------
> But when I build it, I get:
> -------------------------------
> Running "/usr/bin/gmake  -f Makefile CONF=Linux-debug" in /home/jar/
> NetBeansProjects/trunk
>
> /usr/bin/gmake -f nbproject/Makefile-Linux-debug.mk
> SUBPROJECTS= .build-conf
> gmake[1]: Entering directory `/home/jar/NetBeansProjects/trunk'
> mkdir -p build/Linux-debug/GNU-Linux-x86/src
> gcc    -c -g -I/usr/include/netinet -I/usr/include -I/usr/include/sys -
> I/usr/include/gnu -o build/Linux-debug/GNU-Linux-x86/src/tkfPusher.o
> src/tkfPusher.c
> In file included from /usr/include/sys/unistd.h:1,
>                  from /usr/include/sys/unistd.h:1,
>                  from /usr/include/sys/unistd.h:1,
>                  from /usr/include/sys/unistd.h:1,
>                  from /usr/include/sys/unistd.h:1,
>                  from /usr/include/sys/unistd.h:1,
>                  from /usr/include/sys/unistd.h:1,
>                  from /usr/include/sys/unistd.h:1,
> .......
>                  from /usr/include/sys/unistd.h:1,
>                  from /usr/include/sys/unistd.h:1,
>                  from src/tkfPusher.c:20:
> /usr/include/sys/unistd.h:1:20: error: #include nested too deeply
> In file included from /usr/include/sys/errno.h:1,
>                  from /usr/include/sys/errno.h:1,
>                  from /usr/include/sys/errno.h:1,
> . . . . .
>                  from /usr/include/sys/errno.h:1,
>                  from /usr/include/sys/errno.h:1,
>                  from /usr/include/sys/errno.h:1,
>                  from /usr/include/sys/errno.h:1,
>                  from /usr/include/sys/errno.h:1,
>                  from src/tkfPusher.c:30:
> /usr/include/sys/errno.h:1:19: error: #include nested too deeply
> src/tkfPusher.c: In function 'main':
> ----------------------------------------
> How do I resolve these nesting errors?
>
> Thanks,
> Jim

I fixed this. ONLY put the include directory in your list, not the sys
directory also.