У меня проблема с этим файлом cpp:
Я пытаюсь скомпилировать его, чтобы получить его .o, но компиляция невозможна
Сначала я изменил существующие, изменив включения, которые не были совместимы с Windows.
Я добавил "pthreads": https://sourceware.org/pthreads-win32/
Однако, есть проблемы с компиляцией
/*
oscpack -- Open Sound Control (OSC) packet manipulation library
http://www.rossbencina.com/code/oscpack
Copyright (c) 2004-2013 Ross Bencina <rossb@audiomulch.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
The text above constitutes the entire oscpack license; however,
the oscpack developer(s) also make the following non-binding requests:
Any person wishing to distribute modifications to the Software is
requested to send the modifications to the original developer so that
they can be incorporated into the canonical version. It is also
requested that these non-binding requests be included whenever the
above license is reproduced.
*/
#include "../UdpSocket.h"
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN 1
#include <winsock2.h>
#include <windows.h>
#else
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h> // for sockaddr_in
#endif
#include <sys/types.h>
#include <sys/time.h>
#include <signal.h>
#include <math.h>
#include <errno.h>
#include <string.h>
#include <algorithm>
#include <cassert>
#include <cstring> // for memset
#include <stdexcept>
#include <vector>
#include "../PacketListener.h"
#include "../TimerListener.h"
#if defined(__APPLE__) && !defined(_SOCKLEN_T)
// pre system 10.3 didn't have socklen_t
typedef ssize_t socklen_t;
#endif
In file included from c:\mingw\include\pthread.h:288:0,
from UdpSocket.cpp:39:
c:\mingw\include\sched.h:152:47: error: definition of 'int sched_setscheduler' i
s marked 'dllimport'
PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
^~~~~
c:\mingw\include\sched.h:152:47: error: 'pid_t' was not declared in this scope
c:\mingw\include\sched.h:152:58: error: expected primary-expression before 'int'
PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
^~~
c:\mingw\include\sched.h:152:68: error: expression list treated as compound expr
ession in initializer [-fpermissive]
PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
^
c:\mingw\include\sched.h:154:47: error: definition of 'int sched_getscheduler' i
s marked 'dllimport'
PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
^~~~~
c:\mingw\include\sched.h:154:47: error: 'pid_t' was not declared in this scope
In file included from UdpSocket.cpp:39:0:
c:\mingw\include\pthread.h:307:8: error: redefinition of 'struct timespec'
struct timespec {
^~~~~~~~
In file included from c:\mingw\include\pthread.h:218:0,
from UdpSocket.cpp:39:
c:\mingw\include\time.h:115:8: error: previous definition of 'struct timespec'
struct timespec
^~~~~~~~
UdpSocket.cpp: In member function 'void UdpSocket::Implementation::SetEnableBroa
dcast(bool)':
UdpSocket.cpp:140:78: error: cannot convert 'int*' to 'const char*' for argument
'4' to 'int setsockopt(SOCKET, int, int, const char*, int)'
setsockopt(socket_, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast));
^
UdpSocket.cpp: In member function 'void UdpSocket::Implementation::SetAllowReuse
(bool)':
UdpSocket.cpp:146:78: error: cannot convert 'int*' to 'const char*' for argument
'4' to 'int setsockopt(SOCKET, int, int, const char*, int)'
setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, &reuseAddr, sizeof(reuseAddr));
^
UdpSocket.cpp: In member function 'IpEndpointName UdpSocket::Implementation::Loc
alEndpointFor(const IpEndpointName&) const':
UdpSocket.cpp:172:9: error: 'socklen_t' was not declared in this scope
socklen_t length = sizeof(sockAddr);
^~~~~~~~~
UdpSocket.cpp:173:65: error: 'length' was not declared in this scope
if (getsockname(socket_, (struct sockaddr *)&sockAddr, &length) < 0) {
^~~~~~
UdpSocket.cpp:192:39: error: 'EAFNOSUPPORT' was not declared in this scope
if ( connectResult < 0 && errno != EAFNOSUPPORT ) {
^~~~~~~~~~~~
UdpSocket.cpp: In member function 'std::size_t UdpSocket::Implementation::Receiv
eFrom(IpEndpointName&, char*, std::size_t)':
UdpSocket.cpp:245:9: error: 'socklen_t' was not declared in this scope
socklen_t fromAddrLen = sizeof(fromAddr);
^~~~~~~~~
UdpSocket.cpp:248:63: error: expected primary-expression before ')' token
(struct sockaddr *) &fromAddr, (socklen_t*)&fromAddrLen);
^
UdpSocket.cpp:248:65: error: 'fromAddrLen' was not declared in this scope
(struct sockaddr *) &fromAddr, (socklen_t*)&fromAddrLen);
^~~~~~~~~~~
UdpSocket.cpp: In constructor 'SocketReceiveMultiplexer::Implementation::Impleme
ntation()':
UdpSocket.cpp:364:22: error: 'pipe' was not declared in this scope
if( pipe(breakPipe_) != 0 )
^
UdpSocket.cpp: In member function 'void SocketReceiveMultiplexer::Implementation
::Run()':
UdpSocket.cpp:470:40: error: 'suseconds_t' was not declared in this scope
timeout.tv_usec = (suseconds_t)((timeoutMs - (timoutSeconds
Part * 1000)) * 1000);
Если бы кто-то мог мне помочь, я был бы очень благодарен, потому что я действительно блокирую