What does this error mean? "C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc"

Viewed 402

When compiling my program below, I'm getting an error message which I don't really So far, all I'm wanting my code to do is read in a file specified from the command line, and then output a new file with the name changed to having an 'o' at the end.

#include <iostream>
#include <string>
#include <fstream>

using namespace std;

string output_file_name(string file_name)
{   
    string output_file_name;
    file_name.pop_back();
    string ch = "o";
    output_file_name=file_name + ch;

    return output_file_name;
}

int main(int argc, char **argv)
{
    string file_name;

    file_name = argv[1];

    ifstream input_file(file_name);
    ofstream output_file(output_file_name(file_name));

    if(input_file.is_open())
    {
        string line;

        while(getline(input_file, line))
        { 
            //will put code here in future
        }
    }

    input_file.close();

    return 0;
}

ERROR:

D:\visual studio\VC\Tools\MSVC\14.30.30705\include\string(36): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc 
    
D:\visual studio\VC\Tools\MSVC\14.30.30705\include\string(83): note: see reference to function template instantiation 'std::basic_istream<char,std::char_traits<char>> &std::getline<char,std::char_traits<char>,std::allocator<char>>(std::basic_istream<char,std::char_traits<char>> &&,std::basic_string<char,std::char_traits<char>,std::allocator<char>> &,const _Elem)' being compiled
        with
        [
            _Elem=char
        ]
preprocess.cpp(47): note: see reference to function template instantiation 'std::basic_istream<char,std::char_traits<char>> &std::getline<char,std::char_traits<char>,std::allocator<char>>(std::basic_istream<char,std::char_traits<char>> &,std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)' being compiled
0 Answers
Related