3

For testing purposes I am trying to run C++ code, using the X11 API under Windows.

I understand that an X Server must be running and I have installed Xming for this purpose.

But the problem is that I am missing the programmatic interface (the same that is found under Linux as the package X11-dev, including header files and the libX11.a library).

I expected to find a similar library (static or dynamic, with a .lib file and .h header files) for use under Windows, but these seem to be inexistent. What am I missing ?

[I am not after a form of Linux emulation under Windows, but direct calls to the server.]


EDIT : This was added by the poster.

It's alive ! This is under Windows 11, code compiled for 64 bits, native console application, talking to Xming 32 bits server.

enter image description here

11
  • Which version of Windows? Graphical apps in WSL require Windows 11. Commented Apr 2, 2023 at 20:04
  • libx11 is available with vcpkg, maybe that’s good enough for you? Commented Apr 2, 2023 at 20:06
  • @harrymc: I don't want to use WSL. Commented Apr 2, 2023 at 20:09
  • You're probably on Windows 10 then. See perhaps minilibx. Commented Apr 2, 2023 at 20:26
  • I am on Windows 11 and want to work straight from a Windows executable. Commented Apr 2, 2023 at 20:28

1 Answer 1

5

Originally, there was no standard way to get libraries for software development on Windows. You just had to take care of it manually. To address this problem, Microsoft introduced vcpkg a few years ago. It is not unlike package managers you may know from Linux, but there’s a catch: By default, it will always build the packages from source. Depending on how big the dependency tree is and how beefy your computer is, this can take a lot of time. vcpkg does support binary caching, but I’m not aware of public caches.

libx11 is available on vcpkg. To use it, just do vcpkg install libx11. This will take some time because there are quite a few dependencies.


If you do not want to use Microsoft’s compilers, you can still create native Windows executables using MSYS2 or MinGW. Unfortunately, it looks like you’d have to get libx11 manually in these environments.

Manually compiling is always an option anyway, on any (compatible) system.

2
  • Thank you for these extra explanations, I was unaware of this great tool (in fact I did not imagine that code portability from Linux to Windows would be possible at all unless the original source code be ready for that, as the system calls have little in common). The build and installation worked fine and is it a success, Xming is exercised as should. Thanks again. Commented Apr 3, 2023 at 8:06
  • Note that I DO want to use the MS IDEs. Under Linux I am using Eclipse, which as far as I am concerned is a pain in the neck. But the main thing is that I wanted everything working in a single environment. Commented Apr 3, 2023 at 8:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.