zoukankan      html  css  js  c++  java
  • 使用#define定义引用的编译问题

    在一个项目使用math库时,编译出现以下错误。

    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(485) : error C2059: 语法错误 : “(”

    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(485) : error C2059: 语法错误 : “-”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(485) : error C2059: 语法错误 : “)”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(486) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(486) : error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(487) : error C2059: 语法错误 : “(”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(487) : error C2059: 语法错误 : “-”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(487) : error C2059: 语法错误 : “)”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(488) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(488) : error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(491) : error C2059: 语法错误 : “(”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(491) : error C2059: 语法错误 : “-”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(491) : error C2059: 语法错误 : “)”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(492) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(492) : error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(539) : error C2059: 语法错误 : “(”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(539) : error C2059: 语法错误 : “-”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(539) : error C2059: 语法错误 : “)”
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(540) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)
    1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(540) : error C2447: “{”: 缺少函数标题(是否是老式的形式表?)

    看提示应该是abs函数跟某个宏定义有冲突。但搜遍整个工程也没找到这个宏。 

    百思不得其解!

    最后在某个动态库的头文件找到这个宏定义。去掉后编译通过。

    总结:

    1、宏定义函数的一般情况不要定义的跟运行库相同,会引起隐患。

    2、VS的搜索功能,如果不指定路径,只搜索整个工程,是没办法搜索到不在工程里,但在CPP文件包括的文件。

  • 相关阅读:
    Js学习第十天----函数
    IOS Object和javaScript相互调用
    hadoop2.7.1 nutch2.3 二次开发windows环境
    交叉熵代价函数(作用及公式推导)
    推断dxf文件的版本号
    mahout in Action2.2-聚类介绍-K-means聚类算法
    Xcode 技巧充电篇
    Android 推断SD卡是否存在及容量查询
    springmvc学习笔记(12)-springmvc注解开发之包装类型參数绑定
    pip简单配置
  • 原文地址:https://www.cnblogs.com/wantfly/p/2122726.html
Copyright © 2011-2022 走看看