Trouble with C include files - Suse

This is a discussion on Trouble with C include files - Suse ; 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 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Trouble with C include files

  1. Trouble with C include files

    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
    #include
    #include
    #endif

    #ifdef GPC_UNX
    #define JAVA_LOCATION "/usr/bin/java"
    #define TP_LOCATION "~/Tekdraw2/tekPlot/dist/tekPlot.jar"
    #include
    #include
    #include
    #include
    #endif

    // Include for all platforms
    #include
    #include
    #include
    #include

    /*
    *
    */
    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

  2. Re: Trouble with C include files

    On Apr 12, 4:17*pm, "jamesromeongmail.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
    > #include
    > #include
    > #endif
    >
    > #ifdef GPC_UNX
    > #define JAVA_LOCATION "/usr/bin/java"
    > #define TP_LOCATION "~/Tekdraw2/tekPlot/dist/tekPlot.jar"
    > #include
    > #include
    > #include
    > #include
    > #endif
    >
    > // Include for all platforms
    > #include
    > #include
    > #include
    > #include
    >
    > /*
    > **
    > **/
    > 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.

+ Reply to Thread