简体   繁体   English

X11/Xlib.h:没有这样的文件或目录 Windows 10

[英]X11/Xlib.h: No such file or directory Windows 10

I'm working on a school project using FLTK lib to build some graphs with c++:我正在使用 FLTK lib 使用 c++ 构建一些图表的学校项目:

Here is the source of the basic tuto:这是基本教程的来源:

https://github.com/cortical-iv/hello_fltk https://github.com/cortical-iv/hello_fltk

when building this code with the command make, I'm getting this error:使用命令 make 构建此代码时,我收到此错误:

X11/Xlib.h: No such file or directory X11/Xlib.h:没有这样的文件或目录

I searched about this and found that generally X11 lib are used on Linux systems!我对此进行了搜索,发现通常在 Linux 系统上使用 X11 lib!

So please, any idea how can I make this work on windows !所以,请知道如何在 windows 上进行这项工作!

Try adding to Makefile line 2 fltk-config --cflags :尝试添加到 Makefile 第 2 行fltk-config --cflags

CFLAG = -std=c++14 `fltk-config --cflags`

You are probably compiling for 64-bit Windows.您可能正在为 64 位 Windows 进行编译。 FLTK requires that WIN32 be defined even if it is compiled on 64-bit Windows. FLTK 要求定义 WIN32,即使它是在 64 位 Windows 上编译的。 If WIN32 is not defined, then the FLTK headers will include files used on LINUX operating systems instead of Windows.如果未定义 WIN32,则 FLTK 标头将包含在 LINUX 操作系统上使用的文件,而不是 Windows。

FTR: it is correct that FLTK 1.3.x (and the older 1.1.x) requires the compiler macro WIN32 to be set by the build system, ie the command line or in Visual Studio in the compiler setup. FTR:FLTK 1.3.x(和较旧的1.1.x)要求编译器宏WIN32由编译系统设置是正确的,即命令行或编译器设置中的Visual Studio。 This is (was) a non-standard approach and has been changed in FLTK 1.4.这是(曾经)一种非标准方法,并在 FLTK 1.4 中进行了更改。

In FLTK 1.4 (not yet released) we use the standard _WIN32 macro (with leading underscore) which is usually defined in all known compiler environments on Windows [1].在 FLTK 1.4(尚未发布)中,我们使用标准_WIN32宏(带前导下划线),该宏通常在 Windows [1] 上的所有已知编译器环境中定义。 This is true for 32-bit as well as 64-bit compilations.对于 32 位和 64 位编译都是如此。

[1] except if you build using the Cygwin target with the Cygwin dll (POSIX compatibility layer). [1] 除非您使用带有 Cygwin dll(POSIX 兼容层)的 Cygwin 目标进行构建。 (If you don't know what that is, don't care.) (如果您不知道那是什么,请不要在意。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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