socket libraries problem

General questions regarding the usage of CodeLite
cgillopez
CodeLite Curious
Posts: 6
Joined: Thu Feb 25, 2010 7:50 pm
Genuine User: Yes
IDE Question: c++
Contact:

socket libraries problem

Post by cgillopez »

Hello,

I have this bunch of errors i think they are because codelite doesnt know where to find them..

#include <sys/socket.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
C:/Program Files/CodeLite/h264_C++/os.cpp:124: error: aggregate 'sockaddr_in sa_in' has incomplete type and cannot be defined
C:/Program Files/CodeLite/h264_C++/os.cpp:125: error: 'inet_addr' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:127: error: 'AF_INET' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:127: error: 'SOCK_DGRAM' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:127: error: 'socket' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:132: error: 'ntohl' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:135: error: 'SOL_SOCKET' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:135: error: 'SO_REUSEADDR' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:136: error: 'setsockopt' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:150: error: 'memset' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:151: error: 'htons' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:155: error: 'bind' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:162: error: 'ntohl' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:164: error: aggregate 'ip_mreqn aMulticastReq' has incomplete type and cannot be defined
C:/Program Files/CodeLite/h264_C++/os.cpp:166: error: 'INADDR_ANY' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:168: error: 'IPPROTO_IP' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/os.cpp:168: error: 'IP_ADD_MEMBERSHIP' was not declared in this scope




And...
#include <netinet/in.h>
----------Building project:[ codigoConexion - Debug ] (Single File Build)----------
g++ -c "C:/Program Files/CodeLite/h264_C++/session.cpp" -g -o ./Debug/session.o "-I." "-I."
C:/Program Files/CodeLite/h264_C++/session.cpp:6:24: error: netinet/in.h: No such file or directory
C:/Program Files/CodeLite/h264_C++/session.cpp: In member function 'void RTSPSession::read()':
C:/Program Files/CodeLite/h264_C++/session.cpp:491: error: 'u_int16_t' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/session.cpp:491: error: expected primary-expression before ')' token
C:/Program Files/CodeLite/h264_C++/session.cpp:491: error: 'ntohs' was not declared in this scope
C:/Program Files/CodeLite/h264_C++/session.cpp:523: error: 'sleep' was not declared in this scope


Im using windows and codelite 2.6.0.4189. Thankd in advance for your help.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: socket libraries problem

Post by eranif »

This question is not related to codelite. Please post your question in C++ / C forum

Eran
Make sure you have read the HOW TO POST thread
cgillopez
CodeLite Curious
Posts: 6
Joined: Thu Feb 25, 2010 7:50 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: socket libraries problem

Post by cgillopez »

hello eran,

thanks for your quick reply. i think i ask the wrong question...


Sorry if the question is off topic, I really dont think its a C/C++ problem, i read i have to use #include <winsock2.h> but how can i link -lws2_32 to compile??

Thanks for your help.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: socket libraries problem

Post by eranif »

cgillopez wrote:really dont think its a C/C++ problem
You have an error in your code, which is not related to codelite: in other words: there is no option in codelite that you can set that will remove this errors
cgillopez wrote:but how can i link -lws2_32 to compile??
To add libraries to the linker:
Right click on your project and select 'settings -> linker'
in the field 'Libraries' add:

Code: Select all

ws2_32
Eran
Make sure you have read the HOW TO POST thread
Post Reply