Include unistd h windows

Include unistd h windows

But fork() is still an unsupported function in Windows. As far as I know there is no simple replacement in windows:

‘unistd.h’ is a standard header for Unix(-like) systems, and is not available on Windows. Similarly, fork() is not supported on Windows. It uses a different mechanism for creating processes.

Consider using one of the _spawn, _wspawn Functions instead, or you can use the underlying CreateProcess function if you need more control.

Answering policy: see profile.

Hi I am trying to use fork() system command which requires unistd.h.

When I try to include that file, it give me following error:

fatal error C1083: Cannot open include file: ‘unistd.h’: No such file or directory Error executing cl.exe.

I wanted to know if I can use «pragma» command somehow to add it to my project, or somebody knows of better way

If you do work on Windows, then this thread can help to understand the problem — «Is there a replacement for unistd.h for Windows (Visual C)?»

The function fork is not a standard Win32 function and I’m not sure if it is available in 3rd party libraries for windows.

It is available in third-party libraries; for example, CygWin jumps through a number of hoops to emulate fork() on windows, but it’s not exactly the same thing, but close enough for many uses. Note: this is not a recommendation.

Answering policy: see profile.

Thanks for the replies. I have made client server programming in MVC++ 6.0. I was not able to complie my program at first even though I was doing everything right. I was getting 102 errors JUST because I was missing winsock library.

I could not simplyi nclude it using #include , I had to use: pragma comment (lib «winsock»).

Just by doing this, my 102 errors went away, and program worked like a charm.

The reason I need to use that command is handle multiple connections. At the moment, user connectes to my server program. Server authenticates to my own made database you can say. Then I disconect user from my server and then take care of the next user.

The problem with this is that I cannot keep track of who is logged on, and above all I cannot check for double login.

Or what if 50 users try to login at the same time. Even if I connect and disconnect one by one. I cannot finish all users and by the time, some users will get «SERVER OFFLINE» message.

I am very confident there is a way to include that file. I was not confident to make my own file stdlib.h and copy and paste contents from web. just I didn’t have to make winsock

Читайте также:  Касперский endpoint security для windows 10 когда

Compile error on Windows: cannot include ‘unistd.h’ #362

Comments

bradrn commented Jul 21, 2019

When I try compiling on Windows, I get the following error:

Based on the error message, this seems to occur when attempting to compile Assimp.

OS information: using Windows 10. Compilation was attempted using both the Visual Studio Developer Command Prompt and MinGW/MSYS2, resulting in the same output each time.

The text was updated successfully, but these errors were encountered:

bradrn commented Jul 23, 2019 •

Thanks for responding @digego!

You should definitely not use MinGW.
What happens if you build the solution using Visual Studio?

I did originally build it using the Visual Studio Developer Prompt. It was only when that didn’t work that I tried using MinGW in the hope that it would provide unistd.h . I didn’t use the Visual Studio IDE though; I’ll try that now with your instructions.

bradrn commented Jul 23, 2019 •

The compilation has halted here:

The compilation process is still running, but it’s been frozen at this point for about 5 minutes now. For now I’m letting it run, but I’m not sure what’s happening.

EDIT: It seems to have moved on now to libs/external/glfw3.xtm . So it looks like there wasn’t really any error. (At least, if there was, it wasn’t important enough to stop compilation.)

bradrn commented Jul 23, 2019

I’m fairly sure that something funny is going on with the compilation, since it’s 2 hours later but the compilation is only about 50% completed. The same thing keeps happening as the above: it AOT-compiles another file, stops at the line 25>CUSTOMBUILD : error : could not find
dynamic library , then waits for about 10 minutes before going on to the next file. I have no idea what’s happening, but I don’t think it’s normal.

bradrn commented Jul 23, 2019

Well, it appears I spoke too soon. The compilation is now done and extempore seems to be working. Thanks @digego for your help! I’ve been stuck using the old 2016 build, and the new version already seems like an improvement!

However, I won’t close this issue just yet, as there are still problems to be resolved:

  1. Why did the documented instructions in the README fail?
  2. Why does the Visual Studio IDE compilation take such a long time, and report those weird library errors, but still results in a working executable?

bradrn commented Jul 23, 2019

(Sorry for only replying now, I didn’t see your messages)

What did the ‘final’ line of the build say?

How many ‘succeeded’ and how many ‘failed’ ?

So it looks like some projects did fail. It looks like the failed ones were assimp.vcxproj , ALL_BUILD.vcxproj , aot_external.vcxproj (in the order in which the FAILED messages appear). Weirdly, it still created an extempore.exe executable, which seems to be working fine.

digego commented Jul 23, 2019

The extempore.exe doesn’t use those projects, but some of extempore’s xtlang libs do. You’ll only run into problems when you try to use those libraries at runtime. For example, if assimp isn’t building you will not be able to load 3dmodels.

I suspect that cmake is building the solution incorrectly — although I’m not sure why — perhaps it’s getting confused with other versions of those libraries installed locally on your system or some such. All I can say is that it should work ok. It’s building fine for me (and others), so I suspect there is something odd with your particular installation.

Читайте также:  Драйвер для микрофона realtek high definition audio windows 10

Tomorrow, I will build you a custom package to install. You won’t be able to fish (build your own from source) but you will at least have a working install.

bradrn commented Jul 23, 2019

The extempore.exe doesn’t use those projects, but some of extempore’s xtlang libs do. You’ll only run into problems when you try to use those libraries at runtime. For example, if assimp isn’t building you will not be able to load 3dmodels.

That’s the conclusion I came to as well, but I wasn’t sure if it was correct.

I suspect that cmake is building the solution incorrectly … perhaps it’s getting confused with other versions of those libraries installed locally on your system or some such.

It’s possible. I don’t think that particular issue is the problem though — as far as I’m aware, I don’t even have these libraries installed!

Tomorrow, I will build you a custom package to install.

Thanks @digego! But I don’t think it’s necessary — I’m only really interested in the audio capabilities of Extempore, and my own build is working fine for those. I’m not particularly interested in e.g. graphics, so the bits which didn’t build don’t really affect me.

(What I would like is a new release — the last one is from 2016 — but presumably there’s a reason why another release hasn’t been created yet.)

bradrn commented Jul 23, 2019

hopefully new release coming soonish

just as a final thought, what happens if you run the solution again

It’s still running, but it looks like exactly the same thing is happening — at the moment it’s stuck on libs/external/glfw3.xtm .

incidentally you might like to look at the new example/sharedsystem/.

Looks very interesting! As you said, it’s undocumented, but I presume this is similar to TidalCycles?

bradrn commented Jul 23, 2019

you’ll need to make sure you have cmake version 3.12+ installed

Is this alright?

cmake —build . —config Release —parallel 1

I’m running it now. At the moment it’s still compiling LLVM, but hopefully it will speed up a bit on the actual compilation of Extempore.

the pattern stuff is, well patterns — so in that sense yes I guess it’s
similar to tidal cycles 🙂

That will be good — in my mind patterns are really the only thing Extempore lacks. Temporal recursion is an amazingly powerful tool, but sometimes I just want to repeat an ostinato. 😄

but probably the more interesting thing is an agreed default multi-core
audio+midi setup for everyone including the new «analogue» synth with
midi-cc, presets etc..

I don’t know what ‘multi-core audio+midi’ refers to — I’ve never used MIDI, so I’m lacking that context. But I agree that the analogue synth is amazing — it was one of the first things I discovered when I tried out the new version of Extempore earlier, and it was incredible to try out some of the different sounds. (Especially since at the moment I’m teaching myself about how synthesizers work!) I don’t understand what ‘presets’ are though — I saw some recent commits about ‘wavetables’ though, is that related?

bradrn commented Jul 23, 2019

presets just makes it super easy to save and load configurations of the
analogue synth.

That seems useful — it’s certainly quite laborious to define them from scratch.

wavetables are cool though, you’ll love them 🙂

I’m sure 😄 . I presume they’re related to wavetable synthesis? (Which I don’t understand yet, but maybe if I play around with them enough…) Are there any examples?

Seeing as you’re on windows — just checking that have set your machines
power plan to High/Ultimate Performance?

I don’t see why it would matter, but I can’t find the setting anyway.

Читайте также:  Linux удалить файл старше 1 года

Anyway, the compilation has finished with a bunch of errors:

These are the same errors I reported at the beginning of this issue; they occur when compiling Assimp. So we’ve confirmed that these errors come up when compiling on the command-line, but disappear when using Visual Studio. I wonder why?

bradrn commented Jul 24, 2019

can you look in extempore/cmake-build/assimp/src/assimp-build/CMakeCache.txt
and search for
Z_HAVE_UNISTD_H:INTERNAL=?

Couldn’t find it. The closest I got were these matches ( rg is ripgrep):

keep digging for the power settings — believe me, it makes a big difference.

I’ll keep looking!

bradrn commented Jul 24, 2019

So @digego — given the search results I specified above, do you have any idea what could be causing this error? I should have mentioned that before I created this issue, the first thing I did was look up what unistd.h was, and it turns out it’s Unix-specific — so I think your speculation about something going wrong with CMake could be valid.

On the other hand, I was just looking at the error message, and I realised it refers to includes in my Emacs installation! So I’ll take Emacs off my PATH and try compiling again,

bradrn commented Jul 24, 2019

So I’ll take Emacs off my PATH and try compiling again,

The compilation has finished with the same errors. Weirdly, they still referenced the Emacs include files.

On the other hand, I just found something very interesting in my C:\emacs\include\zconf.h — which happens to be the same header file referenced in the error messages! It contains the following lines:

So it looks like CMake is compiling Assimp, somehow finding Emacs’s zconf.h , and using it — even though it is incorrectly set up to try and load unistd.h ! I’ve removed those lines from zconf.h and tried compiling again — it’s running now.

bradrn commented Jul 24, 2019

That did seem to be the problem — Extempore has now compiled successfully!

Sorry for wasting such a long time on a simple problem — as I mentioned above, it turned out that the only problem was that an Emacs file wasn’t configured correctly, and CMake was somehow using that file as part of its compilation. Thanks for the help @digego!

bradrn commented Jul 24, 2019

(Oh, and as for the power plan thing, it turns out that by default the Ultimate plan is not available on battery-powered laptops because of the amount of power it consumes. I think for now I’ll leave the plan as it is — for my purposes, it’s working fine already.)

bradrn commented Jul 24, 2019

By the way, I was just playing around with the sharedsystem examples you mentioned earlier, and they are amazing! With this sort of functionality, Extempore looks better than any other livecoding system I’ve seen before! (And that includes SuperCollider, ChucK, Tidal and all the other major ones.)

Оцените статью