zoukankan      html  css  js  c++  java
  • C 和 C++ 混合代码 cmath编译出错

    最近在网上下载了 Triangle 库,准备在程序中调用来三角化生成网格,但出现了很多错误,如下:

    1>  triangle.c
    1>d:program filesvisualstudio2010vcincludecmath(19): error C2061: 语法错误: 标识符“acosf”
    1>d:program filesvisualstudio2010vcincludecmath(19): error C2059: 语法错误:“;”
    1>d:program filesvisualstudio2010vcincludecmath(19): error C2061: 语法错误: 标识符“asinf”
    1>d:program filesvisualstudio2010vcincludecmath(19): error C2059: 语法错误:“;”
    1>d:program filesvisualstudio2010vcincludecmath(20): error C2061: 语法错误: 标识符“atanf”
    1>d:program filesvisualstudio2010vcincludecmath(20): error C2059: 语法错误:“;”
    1>d:program filesvisualstudio2010vcincludecmath(20): error C2061: 语法错误: 标识符“atan2f”
    1>d:program filesvisualstudio2010vcincludecmath(20): error C2059: 语法错误:“;”

    ………..

    由于我使用的是VS2010,用 C++ 写的程序,而Triangle库是用 C 语言写的,问题可能出在这。百度下这个错误,在自古英雄谁无泪的博客中找到了解决办法,更多请参考歆悰的博文和stackoverflow的ms vc++ iostream compile error

    项目 ––> 属性 ––> 配置属性 ––> C/C++ ––> 高级 ––> 编译为 ––> 编译为C++代码

    另外该博文的原作歆悰的心得很有道理,故放在这里同时告诫自己!

    心得:

    所有跟C++相关的语句均报错,应该能够想得到是环境的问题,不善于思考了,唉。

    代码没问题,肯定是环境的问题。

    搜索英文的解决方案比较靠谱和专业,中文的回复太多垃圾。

  • 相关阅读:
    Linux找回root密码
    关于Linux的随笔笔记
    需求征集系统进度03
    需求征集系统进度02
    需求征集系统进度01
    第六周总结
    阅读笔记03
    第一周总结
    第五周总结
    阅读笔记02
  • 原文地址:https://www.cnblogs.com/VVingerfly/p/4670173.html
Copyright © 2011-2022 走看看