Currently creating a header file, and using the ifndef, define, endif, etc to create it.
However, every time I create it, Visual Studio Code is throwing errors.
#ifndef _roundemup_h_
#define _roundemup_h_
#include <iostream>
#include <fstream>
#include <string>
void file_name(std::ifstream &input)
{
std::string filename;
while (true)
{
std::cout << "Please enter a file name: " << std::endl;
getline(std::cin, filename);
input.open(filename);
if (input.is_open())
{
break;
}
std::cerr << "Unable to Process File." << std::endl;
}
}
#endif
Current errors being show:
the #endif for this directive is missing[1,2]
unrecognized preprocessing directive[24,2]
expected a declaration[25,1]
I'm copying this from a header I've made from another program but have changed the header name and ifndef, so you would think there would be no issue?