问题:
Windows下数据可视化问题:将数据生成可视图像。
环境:
Windows 10 64bits;Visual Studio 2013 Update 5;MathGL 2.4.1;CMake。
下载:
MathGL源码: mathgl-2.4.1.tar.gz
解压:
MathGL源码 到【解压目录】,如D:/mathgl-2.4.1
编译:
1 打开cmake-gui.exe
Where is the source code: 填入【解压目录】
Where to build the binaries: 填入【CMake 输出目录(自定义)】
点击按钮【Configure】,选择编译器类型【Visual Studio 12 2013】,configure出错,有很多红色。如图1.
点击红色区域的【Ungrouped Entrues】,去掉所有勾选项,只保留三个(enable-double, enable-opengl, enable-openmp)。
再次点击按钮【Configure】,提示“Configuring done”
点击按钮【Generate】,提示“Generating done”
至此,MathGL的VS2013工程【MathGL2.sln】 生成完毕。CMake软件使用完毕。
2 使用VS2013打开【CMake 输出目录(自定义)】下的MathGL2.sln解决方案
【本文章仅编译解决方案里面两个项目:mgl,mgl-static】
先编译项目mgl,出错:
错误1:没有打开文件“unistd.h”
在VC的include目录下(C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include)新建文件 unistd.h。内容如下:
/** This file is part of the Mingw32 package.
* unistd.h maps (roughly) to io.h
* Mylaf 2017-08-15
*/
#ifndef _UNISTD_H
#define _UNISTD_H
#include <io.h>
#include <process.h>
#endif /* _UNISTD_H */
错误2:E:\Mylaf\Rebuild\mathgl-2.4.1\src\prim.cpp(1188): error C2057: 应输入常量表达式
修改代码1:
//HMDT dat[m]; // 原始
HMDT* dat = new HMDT[m]; // 修改 mylaf 2017-08-15
if (dat==NULL) {
return;
}
修改代码2:(函数末尾,释放dat)
delete[] dat; // 添加 Mylaf 2017-08-15
dat = NULL;
g->InPlot(0,1,0,1,true);
gr->EndGroup();
gr->SetFontSize(ofsize);