Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/148.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 编译C++;错误 #包括“std_lib_facilities.h” int main() { constexpr双倍欧元兑美元=1.11; constexpr双日元兑美元=0.0081; 双美元=1.00; 字符单位='A'; cout>美元>>单位; 如果(单位为‘e’) cout_C++_Compiler Errors - Fatal编程技术网

C++ 编译C++;错误 #包括“std_lib_facilities.h” int main() { constexpr双倍欧元兑美元=1.11; constexpr双日元兑美元=0.0081; 双美元=1.00; 字符单位='A'; cout>美元>>单位; 如果(单位为‘e’) cout

C++ 编译C++;错误 #包括“std_lib_facilities.h” int main() { constexpr双倍欧元兑美元=1.11; constexpr双日元兑美元=0.0081; 双美元=1.00; 字符单位='A'; cout>美元>>单位; 如果(单位为‘e’) cout,c++,compiler-errors,C++,Compiler Errors,C++11中引入了constepr关键字,使用-std=C++11编译示例: 使用g++:g++main.cpp-o program.exe-std=c++11 代码::BR>设置>编译器>编译器设置>编译器标志>勾选代码>代码> G++遵循C++ ISO C++语言标准< /COD> > OK 您还在if语句中为变量赋值,替换为=: 5 error: 'constexpr' was not declared in this scope 5 error: expected ';'

C++11中引入了
constepr
关键字,使用
-std=C++11编译
示例:

使用g++:
g++main.cpp-o program.exe-std=c++11

代码::BR>设置>编译器>编译器设置>编译器标志>勾选代码>代码> G++遵循C++ ISO C++语言标准< /COD> > OK


您还在if语句中为变量赋值,替换为
=

5 error: 'constexpr' was not declared in this scope 5 error: expected ';' before 'double' 7 error: expected ';' before 'double' 15 error: 'euro_to_dollar' was not declared in this scope 17 error: 'yen_to_dollar' was not declared in this scope 及


您缺少了一个
我不知道您的本地头文件中有什么

cout <"Please enter a value followed by e or y: \n";
 //  ^
作为替代,我添加了以下代码行

#include "std_lib_facilities.h"

此外,您应该使用编译器选项编译。您使用的编译器是什么?它支持c++11吗
else if (unit='y')
        //   ^
cout <"Please enter a value followed by e or y: \n";
 //  ^
#include "std_lib_facilities.h"
#include<iostream>

using namespace std;
else if (unit =='y')