Filter löschen
Filter löschen

error in header file socket.h

2 Ansichten (letzte 30 Tage)
jiji hr
jiji hr am 2 Mai 2016
Kommentiert: jiji hr am 6 Mai 2016
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 Kommentare
Walter Roberson
Walter Roberson am 2 Mai 2016
For a C++ program, shouldn't you #include <socket> rather than #include <socket.h> ?
jiji hr
jiji hr am 6 Mai 2016
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by