필터 지우기
필터 지우기

error in header file socket.h

조회 수: 2 (최근 30일)
jiji hr
jiji hr 2016년 5월 2일
댓글: jiji hr 2016년 5월 6일
Hi, I encouter this error while compilation after adding the header file socket.h to the include repertory of visual studio.10 and I am using matlab 2013. this is the log error file :
perform_front_propagation_anisotropic.cpp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(119) : error C2146: syntax error : missing ';' before identifier 'sa_len'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(119) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(119) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(120) : error C2146: syntax error : missing ';' before identifier 'sa_family'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(120) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(120) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(129) : error C2146: syntax error : missing ';' before identifier 'sp_family'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(129) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(129) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(130) : error C2146: syntax error : missing ';' before identifier 'sp_protocol'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(130) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(130) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(173) : error C2146: syntax error : missing ';' before identifier 'msg_name'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(173) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(173) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(174) : error C2146: syntax error : missing ';' before identifier 'msg_namelen'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(174) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(174) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(176) : error C2146: syntax error : missing ';' before identifier 'msg_iovlen'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(176) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(176) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(177) : error C2146: syntax error : missing ';' before identifier 'msg_control'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(177) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(177) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(178) : error C2146: syntax error : missing ';' before identifier 'msg_controllen'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(178) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(178) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(197) : error C2146: syntax error : missing ';' before identifier 'cmsg_len'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(197) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(197) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(222) : error C2146: syntax error : missing ';' before identifier 'sa_family'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(222) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(222) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(230) : error C2146: syntax error : missing ';' before identifier 'msg_name'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(230) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(230) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(234) : error C2146: syntax error : missing ';' before identifier 'msg_accrights'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(234) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(234) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\sys/socket.h(240) : fatal error C1083: Cannot open include file: 'sys/cdefs.h': No such file or directory
any help would be appreciated;
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 5월 2일
For a C++ program, shouldn't you #include <socket> rather than #include <socket.h> ?
jiji hr
jiji hr 2016년 5월 6일
I don't think so sir, if that was the problem it should tell me that the file socket.h doesn't existe, but it is a problem with the socket.h file. Any way I think I found the problem where it is after paying attention to the contente of the file, I am actually working on windows, and It seems that i included i Unix File, so instead of including socket.h I had to include winsock2.h.
Thank you so much for your interaction.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by