简体   繁体   English

VS 2015的HYPRE blas构建错误

[英]HYPRE blas build error with VS 2015

I installed VS 2015 Professional. 我安装了VS 2015 Professional。 I installed the latest HYPRE, from the Lawrence Livermore website . 我从Lawrence Livermore 网站安装了最新的HYPRE。 I then configured it using CMake and proceeded to build, and I started getting BLAS ( dnrm2.c ) build errors: 然后,我使用CMake配置了它并继续构建,然后开始出现BLAS( dnrm2.c )构建错误:

2>         dnrm2.c
2>     1>
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\math.h(454): error C2059: syntax error: '('

The line of code triggering the error in dnrm2.c is: dnrm2.c触发错误的代码行是:

#include "math.h"

which points to the file: 指向文件:

c:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\math.h

I looked up this error and found some suggestions such as this to change the include to: 我抬头一看这个错误,并发现了一些建议,如这一改变包括到:

#include <cmath>

and to edit the HYPRE project settings in: Configuration > C/C++ > Advanced > Compile As to Compile As C++ (/TP) 并在以下位置编辑HYPRE项目设置: Configuration > C/C++ > Advanced > Compile AsCompile As C++ (/TP)

which I did, but I still see same error, since apparently the same header path to math.h is included from cmath as well: 我做了,但是我仍然看到相同的错误,因为从cmath中也显然包括了math.h的相同头文件路径:

#else /* _STD_USING */
 #include <math.h>
#endif /* _STD_USING */

I've even tried re-installing VS 2015 without any luck (same errors). 我什至尝试重新安装VS 2015,但没有任何运气(相同的错误)。 Appreciate any ideas on what's going on here, and how to resolve this. 感谢有关这里发生的事情以及如何解决此问题的任何想法。 I guess I could try a minimalist example in VS 2015 that includes the math.h and report back, if that helps. 我想我可以在VS 2015中尝试一个极简示例,其中包括math.h并进行报告,如果有帮助的话。

EDIT My minimalist example: 编辑我的简约示例:

#include "math.h"

int main() {
  double d1 = sqrt(4.0);
  float d2 = abs(4.0);
  return 0;
} 

appears to be building OK. 似乎正在建造中。 I tried to set the project the same way to Compile as C (or C++, didn't matter). 我试图将项目设置为与C相同的编译方式(或C ++,没关系)。 This doesn't really help me though. 但这对我没有帮助。

OK, the problem here is with HYPRE source it looks like. 好的,这里的问题是看起来像HYPRE源。 They have this in a file f2c.h included before including the math.h : 他们在包含math.h之前将其包含在文件f2c.h

//#undef abs
//#define abs(x) ((x) >= 0 ? (x) : -(x))
//#endif

When I commented it out (since this is already defined in the standard), then it gets past that build error. 当我注释掉它时(因为它已经在标准中定义了),那么它越过了该构建错误。 Of course I run into other build errors. 当然,我遇到其他构建错误。 I'm trying to tackle those separately. 我正在尝试分别解决这些问题。

EDIT: It's not as simple as that because they (HYPRE) actually rely on their own definition of abs . 编辑:这不是那么简单,因为他们(HYPRE)实际上依赖于他们自己对abs的定义。 So I had undo the above and change the order of some includes so that the undef actually made sense. 因此,我撤消了上述内容,并更改了某些包含项的顺序,以使undef实际上有意义。 Either way, this is a HYPRE source code problem. 无论哪种方式,这都是HYPRE源代码问题。

If you succeed in compiling the HYPRE on VS2015, Could you send your VS2015 program to me! 如果您成功在VS2015上编译了HYPRE,能否将VS2015程序发送给我! My major is Geophysics modeling and inversion. 我的专业是地球物理学建模和反演。 MY email is schoolhui@hotmail.com Thank you very much! 我的电子邮件是schoolhui@hotmail.com非常感谢!

I've just commented 我刚刚评论

_Check_return_ int       __cdecl abs(_In_ int _X);

in

c:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\math.h

and then HYPRE was successfully compiled! 然后HYPRE成功编译!

Then, I've uncommented "abs". 然后,我没有评论“ abs”。

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

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