对于Visual Studio,在math.h中超过200个〜SYNTAX ERRORS〜,这没有任何意义 [英] Over 200 ~SYNTAX ERRORS~ in math.h for visual studio, which doesn't make sense

查看:271
本文介绍了对于Visual Studio,在math.h中超过200个〜SYNTAX ERRORS〜,这没有任何意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Visual Studio Express2013用于Windows桌面,并使用"Win32控制台应用程序" C ++项目

(我正在为一个课程做项目.为了开始,我必须导入教练提供的所有项目文件-有很多文件(所有.cpp和.h文件),因此我真的不能在这里复制粘贴任何一个...但是我仍然认为这不是问题所在.)

当我点击运行调试器"时,我在math.h中遇到了近200个语法错误,尽管Visual Studio附带了math.h.

When I hit "run debugger," I get nearly 200 syntax errors in math.h Even though math.h is what came with Visual Studio.

所有错误看起来都很简单,就像:

All the errors seem really simple like:

"Missing ')' before identifier _X'"
"'_X' : undefined identifier"
"'floor' : definition of dllimport data not allowed"
"syntax error : missing ';' before '+'"


etc... these syntax errors go on into the 200s.

(我将复制并粘贴整个错误日志,但是有262个错误,并且它们中都包含文件目录路径,因此你们无法读取)

如果math.h是来自Visual Studio本身的文件,为什么在math.h中会有这么多语法错误?

Why do I have so many syntax errors in math.h if math.h is a file that comes from Visual Studio itself?

(我已经尝试了好几个星期了,在编译之前我无法真正开始从事该项目)

推荐答案

问题可能出在标头本身-C ++为旧C库提供了自己的等效库.它们采用以下格式:

The problem could be the header itself - C++ has provided its own equivalent libraries for old C libraries. They take the format of:

c[library name]

[库名]替换为旧的C库 MINUS .h扩展名.

Where [library name] is replaced by the old C library MINUS the .h extension.

要将C库中的math.h包含在C ++程序中,您可以这样做:

To include math.h from the C library in a C++ program, you would do this:

#include <cmath>

您还可以尝试其他人正在讲的一些事情.

You can also try some of the things the others are stating.

注意:我不确定旧的C标头是否是问题的根源,但是由于C ++确实引入了一些不兼容性,所以很可能就是问题所在.

这篇关于对于Visual Studio,在math.h中超过200个〜SYNTAX ERRORS〜,这没有任何意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆