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.

Library ws2_32.lib CCS

Other Parts Discussed in Thread: TMS320C6678

Hello,

I work on DSP TMS320C6678,

I need to know how send a string using TCP in C++, for now i already do this

...
#include <windows.h>
#include <winsock2.h>
#pragma comment(lib, "ws2_32.lib")    

...
WSADATA WSAData; WSAStartup(MAKEWORD(2,0), &WSAData); SOCKET sock; SOCKADDR_IN sin; sin.sin_addr.s_addr = inet_addr("127.0.0.1"); sin.sin_family = AF_INET; sin.sin_port = htons(8001); sock = socket(AF_INET,SOCK_STREAM,0); bind(sock, (SOCKADDR *)&sin, sizeof(sin)); connect(sock, (SOCKADDR *)&sin, sizeof(sin));

  ...

but the problem is the library"ws2_32".

I don't know how to link it with Code Composer Studio.

and after how to use it.

Thank you.

 

  • Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com). Please read all the links below my signature.

    We will get back to you on the above query shortly. Thank you for your patience.

  • Hi Romain,

    In CCS, go to project properties-->Build-->C6000 Linker-->file search Path--> Add your library using the filename as well as specifying the library directory path.

    For addtional info, Use CCS--> Help contents--> in search --> "linking libraries"

  • Thank you very much. Your answer help me, but now i have to find why the library doesn't work.

    I've got this error :

    "cannot find -lC:/Users/Korisnik/Workspace\ 3.0/test/Debug/ws2_32.lib"

    but the file is in i don't understand

    as you can see.

    (And sorry for my english I try to do my best by the way i'm french) 

  • Hi,

    I've got this error :

    "cannot find -lC:/Users/Korisnik/Workspace\ 3.0/test/Debug/ws2_32.lib"

    It seems to be problem with wrong symbol used "/" and "\" , so please make sure that you have given correctly.

    Please refer to the following TI wiki page, chapter "Adding Libraries - Proper Include"

    Example:

     

  • ws2_32.lib is the library that provides the user-level API for Windows Sockets. TI-RTOS does not implement Windows Sockets. For example, WSADATA and WSAStartup() are WinSock-specific, and you do not need a similar call to use sockets functions under TI-RTOS. (I think SOCKET, SOCKADDR and SOCKADDR_IN are also WinSock-specific macros.)

    Similarly, <windows.h> and <winsock2.h> will not exist under TI-RTOS. If you #include the Windows versions of those headers when you are compiling for TI-RTOS, you are likely to introduce problems.

    Look for the example applications under the NDK installation directory to find how to use the standard ("Berkeley") sockets API that is implemented by TI-RTOS. Code that uses Windows- and WinSock-specific headers, macros and functions will require effort to port to the standard API.