首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CL未知错误

CL未知错误
EN

Stack Overflow用户
提问于 2021-06-23 17:23:23
回答 1查看 29关注 0票数 0

我在VSC中用C++编写了一个简单的代码,当我编译它时,cl会给我一些错误,即使它编译得很好。代码是:

代码语言:javascript
复制
#include <iostream>


int main()
{   
    //  Print welcome messages to the terminal
    std::cout << "You are a secret agent breaking into a secure server room\n";
    std::cout << "You need to enter the correct codes to continue..." << std::endl;

    //Declare 3 number code
    const int CodeA = 4;
    const int CodeB = 3;
    const int CodeC = 2;

    
    const int CodeSum = CodeA + CodeB + CodeC;
    const int CodeProduct = CodeA * CodeB * CodeC;

    // Print sum and product to the terminal
    std::cout << std::endl;
    std::cout << "+ There are 3 numbers in the code" << std::endl;
    std::cout << "+ The codes add-up to: " << CodeSum << std::endl;
    std::cout << "+ The code multiply to give: " << CodeProduct << std::endl << std::endl;

    int GuessA, GuessB, GuessC;
    std::cin >> GuessA;
    std::cin >> GuessB;
    std::cin >> GuessC;
    std::cout << "You entered: " << GuessA << GuessB << GuessC << std::endl;

    return 0;
}

我得到的错误消息是:

C:\ Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\ostream(284):Files (x86)\Microsoft Visual Program warning C4530:使用了C++异常处理程序,但未启用展开语义。指定/EHsc

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\ostream(269):注意:编译类模板成员函数'std::basic_ostream &std::basic_ostream::operator <<(X86)‘时

triplex.cpp(22):注意:参见对正在编译的函数模板实例化'std::basic_ostream &std::basic_ostream::operator <<(int)‘的引用

triplex.cpp(7):注意:参见对正在编译的类模板实例化'std::basic_ostream‘的引用

有人能给我解释一下这些是什么吗?提前感谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-23 17:31:13

这只是一个警告,它会告诉你这一点:exception handler used, but unwind semantics are not enabled. Specify /EHsc。如果您在project properties->c/c++->Code generation->enable c++ exceptions下将其设置为Yes (/EHsc)(实际上它应该是默认值),那么您就可以运行了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68097067

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档