1
我對C++相當陌生,當我試圖編譯我的項目時,Visual Studio 2010 Express遇到了一個致命錯誤,說「無法打開包含文件:'ofstream':沒有這樣的文件或目錄」源代碼之一我的執行文件(在那裏我遇到的錯誤)如下:「在Visual Studio 2010 Express Edition中無法打開包含文件:'ofstream'」錯誤?
#include "Character.h"
#include <iostream>
#include <ofstream>
using namespace std;
ofstream characterSave;
// Sets the character's name to what the user inputted
void Character::setName(string name)
{
// Set characterName to equal what user inputted
characterName = name;
}
// Output the character's name when called
string Character::getName()
{
// Return characterName
return characterName;
}
// Save the user's data to save.dat
void Character::saveToFile()
{
// Creates new save file
characterSave.open("character.dat");
// Writes character's name to first line of save file
characterSave << characterName << endl;
// Closes save file
characterSave.close();
}
我四處搜尋網上,我無法找到任何人有這個問題。它可能是我本地的Visual Studio Express副本嗎?任何幫助將非常感激。
Google for ['ofstream'](https://www.google.co.uk/search?q=ofstream),首先[結果](http://www.cplusplus.com/reference/iostream/ofstream) /)顯示你需要標題'' –
2012-04-05 09:33:37