c++ - 如何使用 MSVC 构建 Gnuplot? (syscfg.h(377) : error)

标签 c++ makefile gnuplot

我正在尝试使用 Visual Studio 2015 构建 gnuplot。为此,我运行位于 config\msvc 中的 Makefile:

  1. 启动 Microsoft Visual C++ 命令外壳

  2. 更改为 config\msvc

  3. 运行 nmake -f Makefile

但我收到以下 fatal error :

c:\.......\gnuplot\src\gnuplot-5.0.1\gnuplot-5.0.1\src\syscfg.h(377): error C2632: 'char' ne peut pas être suivi de 'bool'

构建 5.0.1 版 gnuplot for windows 的正确方法吗?您是否已经看到此错误?

最佳答案

问题在于 bool 类型:Microsoft Visual Studio(自 2013 版起)包中包含一个以 bool 作为类型的库。不知何故,HAVE_STDBOOL_H 未在您的系统上定义。 The issue has already been faced when compiling other software.

我可以建议你两种可能性:

1) 在gnuplot-5.0.1\src\syscfg.h第370行上方写入#define HAVE_STDBOOL_H

2) 打开Makefile,将/DHAVE_STDBOOL_H 添加到CFLAGS,甚至添加到CBASEFLAGS

gnuplot-5.0.1\src\syscfg.h (370-384):

#if HAVE_STDBOOL_H
# include <stdbool.h>
#else
# if ! HAVE__BOOL
#  ifdef __cplusplus
typedef bool _Bool;
#  else
typedef unsigned char _Bool;
#  endif
# endif
# define bool _Bool
# define false 0
# define true 1
# define __bool_true_false_are_defined 1
#endif

您构建它的方式被认为是正确的,它与 Makefile 中提供的原始指南一致:

Start the Microsoft Visual C++ command shell (e.g. via link installed setup)
Change to the gnuplot\config\msvc directory
Edit the Makefile to match your setup. (If you don't have the optional libraries, you will probably have to disable some parts.)
Now run:
nmake

关于c++ - 如何使用 MSVC 构建 Gnuplot? (syscfg.h(377) : error),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34392706/

相关文章:

makefile - 使 : *** multiple target patterns. 停止

c++ - gnuplot 可以绘制交互式图形项吗?

plot - 在 Gnuplot 中,如何在 for 循环中的同一个图上多次绘制函数

c++ - 从 vector 中删除对象会破坏 C++ 中另一个对象中的对象

c++ - 与返回引用而不是指针相关的限制

c++ - 创建虚拟分区

bash - 如何将参数传递给 makefile 中的目标?

c++ - 这两者的区别?

makefile - 如何连接 Makefile 中的字符串?

gnuplot - 在绘制为直方图的数据上叠加高斯形状