简体   繁体   中英

Fatal error when compiling #include <sys/uio.h> on project [windows]

trying to compile a file for class, using the mingw compiler on windows 10. Compiling with g++ gives me an error stating

\projectFile.o
mingw32-g++.exe  -o D:\GitHub\GitRepo\projectFile.exe D:\GitHub\GitRepo\projectFile.o   
D:\GitRepo\projectFile.cpp:16:20: fatal error: sys/uio.h: No such file or directory
compilation terminated.

From what ive read this header file

#include <sys/uio.h>

is a unix header and is generally included with most unix build environments. I am working on Windows 10 build and have been unsuccessful in trying to get this to work. Is there a work around for windows using different headers? Is there a while to install this file somehow?

The project is a generalized XML parser that as a student my job is to extract functions from the main file so that they can be reused (OOP design space)

#include <iostream>
#include <iterator>
#include <string>
#include <cstring>
#include <sys/types.h>
#include <sys/io.h>
#include <unistd.h>
#include <errno.h>
#include <vector>
#include <algorithm>
#include <ctype.h>
#include "XMLParser.hpp"

Built on Windows 10 (lastest build) with Mingw-64 (lastest version) This will not compile for me

This fixed my problem creating this uio.h file in sys directory of mingw64

#ifndef SYS_UIO_H
#define SYS_UIO_H

#include <inttypes.h>
#include <unistd.h>

struct iovec
{
    void    *iov_base;  /* Base address of a memory region for input or output */
    size_t   iov_len;   /* The size of the memory pointed to by iov_base */
};

 ssize_t readv(int fildes, const struct iovec *iov, int iovcnt);
ssize_t writev(int fildes, const struct iovec *iov, int iovcnt);

#endif /* SYS_UIO_H */

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM