This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

redefinition of socket functions

hi, 

i'm using the following platform:

- tirtos_tivac_2.10.01.38

- CCS  6.0.1.00040

- xdctools_3_30_06_67_core

i want to use the BSD socket.h library, but for unknown reason i'm getting many errors due duplicate in the socket.h definitions one of them is

C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc

and the other in:

C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\bsd\sys

the errors are: 

Description Resource Path Location Type
#249 function "FD_ISSET" has already been defined .ccsproject /ICG line 90, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "FD_SET" has already been defined .ccsproject /ICG line 101, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "accept" has already been defined .ccsproject /ICG line 121, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "bind" has already been defined .ccsproject /ICG line 129, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#102 "IP6N" has already been declared in the current scope .ccsproject /ICG line 58, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\usertype.h C/C++ Problem
#258 invalid redeclaration of type name "IP6N" (declared at line 80 of "c:/ti/tirtos_tivac_2_10_01_38/products/ndk_2_24_01_18/packages/ti/ndk/inc/bsd/sys/socket.h") .ccsproject /ICG line 66, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\usertype.h C/C++ Problem
#249 function "FD_ZERO" has already been defined .ccsproject /ICG line 68, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "FD_CLR" has already been defined .ccsproject /ICG line 79, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "socket" has already been defined .ccsproject /ICG line 279, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "recv" has already been defined .ccsproject /ICG line 187, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#20 identifier "CI_SERVICE_DHCPC" is undefined DC_CORE.c /ICG/ATI Library/Service Layer/System/Diagonstic Console line 654 C/C++ Problem
#20 identifier "CI_ROUTE" is undefined DC_CORE.c /ICG/ATI Library/Service Layer/System/Diagonstic Console line 653 C/C++ Problem
#249 function "listen" has already been defined .ccsproject /ICG line 179, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#20 identifier "CI_IPNET" is undefined DC_CORE.c /ICG/ATI Library/Service Layer/System/Diagonstic Console line 652 C/C++ Problem
#249 function "getsockopt" has already been defined .ccsproject /ICG line 170, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "connect" has already been defined .ccsproject /ICG line 137, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "setsockopt" has already been defined .ccsproject /ICG line 262, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "sendto" has already been defined .ccsproject /ICG line 237, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "send" has already been defined .ccsproject /ICG line 229, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem
#249 function "recvfrom" has already been defined .ccsproject /ICG line 195, external location: C:\ti\tirtos_tivac_2_10_01_38\products\ndk_2_24_01_18\packages\ti\ndk\inc\socket.h C/C++ Problem

So how can i fix this conflict?

Thanks,

Mohamed Fawzy

  • Mohamed,

    Can you please expand on “I want to use the BSD socket.h library”?  What did you do to try this?

    Thanks,
    Scott

  • Scott,

    simply, i want to use the socket functions which are consistent with the Berkley definitions, and this is why i include

    #include <sys/socket.h>

    but it sames that the compiler still looking at the library that are defined by the NDK, i don't know can i prevent the compiler to look at the socket.h in the NDK and look at the one in the BSD.

    BTW, i using many of NDK component such that i'm using the http client.

     

    Thanks,

    Mohamed Fawzy

  • Scott,

    Any update regarding my question, it is urgent for me.

    Thanks,

    Mohamed Fawzy

  • Mohamed,

    When you included <sys/socket.h> did you remove any inclusion of  <ti/ndk/inc/socket.h>?  Somehow the compiler is seeing both include files and therefore multiple definitions.

    If there isn’t an explicit include of <ti/ndk/inc/socket.h> in your C file, is it possibly included by one of the files your C file is including? 

    And have you tried doing a clean of the project, and then a rebuild?

    Also, are you able to successfully build the tcpEcho example that comes with TI-RTOS?  This example selects BSD support and includes <sys/socket.h>.

    If you are still seeing an issue, is it possible for you to zip up and send me your project?

    Thanks,
    Scott

  • Scott,

    As i mentined in the first post that i'm using the WEB component from TIRTOS beside some of the functions NIMUIoctl and CfgGetImmediate, so i need to include the following files:

    #include <ti/drivers/EMAC.h>

    #include <ti/drivers/emac/EMACSnow.h>

    #include <ti/ndk/inc/netmain.h>

    #include <ti/ndk/inc/_stack.h>

    which somehow will include the socket from NDK.

    So please advice.

     

    Thanks,

     

    Mohamed Fawzy

     

     

     

  • Mohamed,

    OK, thanks.  

    To do this you’ll need to partition BSD-style socket code into a separate C file.  There is some description of this requirement, and others relating to BSD compatibility in “3.4.1.1 Things to Remember About BSD Compatibility: File separation” in the NDK Reference Guide (www.ti.com/.../spru524i.pdf).

    Regards,
    Scott