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++相关的语句均报错,应该能够想得到是环境的问题,不善于思考了,唉。

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

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

  • 相关阅读:
    python笔记1
    git笔记
    手撸一个简陋直播系统
    spring-boot学习笔记1
    设计模式1--简单工厂模式
    网联:第一章:浏览器生成消息
    php线上预览日志--4.websocket客户端
    php线上预览日志--3.websocket服务部署
    php线上预览日志--2.谷歌插件开发
    php线上预览日志--1.概述
  • 原文地址:https://www.cnblogs.com/VVingerfly/p/4670173.html
Copyright © 2011-2022 走看看