header cmath Intellisense errors in VS 2017

2020-04-02 06:45发布

the header cmath simply doesn't work, when I open the cmath header file in my project, the VS Intellisense shows errors like the global scope has no "acosf", and there are hundreds.

I have read a lot of threads but haven't figured it out. I have confirmed that I am using sdk 10.0.15063.0 according to one thread, but it doesn't work.

Any project including cmath doesn't work, so it might has nothing to do specific code. I have tried my best, could you guys tell to how to solve it? Thanks in advance!

The full error list is as below:

Severity        Code    Description                     Project     File                                                                                                       Line Suppression State
Error (active)  E0282   the global scope has no "acosf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   25  
Error (active)  E0282   the global scope has no "acoshf"    Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   30  
Error (active)  E0282   the global scope has no "asinf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   35  
Error (active)  E0282   the global scope has no "asinhf"    Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   40  
Error (active)  E0282   the global scope has no "atanf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   45  
Error (active)  E0282   the global scope has no "atanhf"    Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   50  
Error (active)  E0282   the global scope has no "atan2f"    Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   55  
Error (active)  E0282   the global scope has no "cbrtf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   60  
Error (active)  E0282   the global scope has no "ceilf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   65  
Error (active)  E0282   the global scope has no "copysignf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   71  
Error (active)  E0282   the global scope has no "cosf"  Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   76  
Error (active)  E0282   the global scope has no "coshf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   81  
Error (active)  E0282   the global scope has no "erff"  Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   86  
Error (active)  E0282   the global scope has no "erfcf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   91  
Error (active)  E0282   the global scope has no "expf"  Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   96  
Error (active)  E0282   the global scope has no "exp2f" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   101 
Error (active)  E0282   the global scope has no "expm1f"    Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   106 
Error (active)  E0282   the global scope has no "fabsf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   111 
Error (active)  E0282   the global scope has no "fdimf" Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   116 
Error (active)  E0282   the global scope has no "floorf"    Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   121 
Error (active)  E0282   the global scope has no "fmaf"  Project7    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cmath   127 
//etc

///////////////////////////edit: This is the header including the cmath, from Strousrup's c++ PPP:

ifndef GRAPH_GUARD
#define GRAPH_GUARD 1
#include "Point.h"
#include <vector>
#include <string>
#include <cmath>
#include "fltk.h"
#include "std_lib_facilities.h"

namespace Graph_lib {
// defense against ill-behaved Linux macros:
#undef major
#undef minor

struct Color {
    enum Color_type {
        red=FL_RED, blue=FL_BLUE, green=FL_GREEN,
        yellow=FL_YELLOW, white=FL_WHITE, black=FL_BLACK,
        magenta=FL_MAGENTA, cyan=FL_CYAN, dark_red=FL_DARK_RED,
        dark_green=FL_DARK_GREEN, dark_yellow=FL_DARK_YELLOW, dark_blue=FL_DARK_BLUE
//etc

///////////////////////edit:

using namespace std is included in "std_lib_facilities.h".

spinet from "std_lib_facilities.h":

#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1

#ifndef H112
#define H112 201004L

#include<iostream>
#include<fstream>
#include<sstream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<list>
#include<vector>
#include<algorithm>
#include<stdexcept>

//etc------------------

1条回答
混吃等死
2楼-- · 2020-04-02 07:17

Thanks guys, I have solved the problem. It is because of the clash of different math.hs in the include directories.

查看更多
登录 后发表回答