Menu

#include <unistd.h> in Windows

jordi73
2018-02-04
2018-02-07
  • jordi73

    jordi73 - 2018-02-04

    Hi,
    I tried to compile the latest version under Win81 with 64 bit VS2017. Get problem with missing

    include <unistd.h> in PathManager.cpp</unistd.h>

    currently solved so: moved #include <unistd.h> into the #else section of ifdef _win32 and added </unistd.h>

    include <direct.h></direct.h>

    include <stdlib.h></stdlib.h>

    include <stdio.h></stdio.h>

    so finally:

    ifdef _WIN32

    include <windows.h></windows.h>

    include <direct.h></direct.h>

    include <stdlib.h></stdlib.h>

    include <stdio.h></stdio.h>

    else

    include <unistd.h></unistd.h>

    include <sys stat.h=""></sys>

    include <sys types.h=""></sys>

    include <sys syscall.h=""></sys>

    endif

    and set _rmdir and and _rmdir as well in ifdef win32

    ifdef _WIN32

            _rmdir(PathEncode((*it)).c_str());
    

    else

            rmdir(PathEncode((*it)).c_str());
    

    endif

    ifdef _WIN32

                std::replace( part.begin(), part.end(), _T( '/' ), _T( '\\' ) );
                res = _mkdir( PathEncode( part ).c_str() );
    

    else

                res = mkdir( PathEncode( part ).c_str(), 0777 );
    

    endif

    So I get it compiled (again) and it works, please consider the small changes for the next update :-) thanks

     

    Last edit: jordi73 2018-02-04
  • Alexandr Belyak

    Alexandr Belyak - 2018-02-07

    Hi,
    Thanks for your helpful message!
    Indeed, the header file <unistd.h> in the new version of Visual Studio is deprecated.</unistd.h>

    In the next update I will add your changes :-)
    Thanks again for your help in the development of the library!

     

Log in to post a comment.