我创建了一个标头文件,以将其他headerfiles作为捷径包含,并且几乎适用于我的所有文件,但是我对文件I/O文件有问题(IT引发错误的错误,内容不包括文件(。
包括文件(includ.h(
#ifndef INCLUDES_H_
#define INCLUDES_H_
#include <vector>
#include "html.h"
#include "file.h"
#include <string>
#include "test.h"
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <cstdlib>
#endif
file(file.h(
#ifndef FILE_H_
#define FILE_H_
#include "includes.h"
namespace file
{
int file()
{
std::string filename;
std::cout <<"What would you like to name your file?n";
std::cout << "(don't put in the .html)n";
std::cin >> filename;
filename = filename +".html";
std::ofstream outf(filename);
return 0;
}
}
#endif
您不应该在files.h
文件中加入files.h
。
制作大量的文件似乎是一个坏主意。无论是否实际需要,所有时间都在任何时候都包含在任何时候。这可能会导致难以诊断错误。
仅包括您需要的东西。