我正在尝试使用 Visual Studio 2015 构建 gnuplot。为此,我运行位于 config\msvc
中的 Makefile:
启动 Microsoft Visual C++ 命令外壳
更改为
config\msvc
运行
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/