C++ 在vs2010中写入文件(c+;+;,win32)

C++ 在vs2010中写入文件(c+;+;,win32),c++,winapi,filestream,C++,Winapi,Filestream,我之前问过这个问题,你让我提到错误, 所以我现在要提到它们(我不知道如何继续我开始的最后一个线程,我看到的只是一个“添加评论”按钮和一个“回答你的问题”按钮,所以我必须更正问题并再次提问,对此表示抱歉): 我的问题如下: 我正在使用VisualStudio2010,我正在编写一个win32应用程序(不是控制台应用程序)。 我需要知道如何从这个应用程序写入文件 我包括了这些标题:windows.h、stdlib.h、string.h和tchar.h 我编写了一个非常简单的hello world应用

我之前问过这个问题,你让我提到错误, 所以我现在要提到它们(我不知道如何继续我开始的最后一个线程,我看到的只是一个“添加评论”按钮和一个“回答你的问题”按钮,所以我必须更正问题并再次提问,对此表示抱歉):

我的问题如下: 我正在使用VisualStudio2010,我正在编写一个win32应用程序(不是控制台应用程序)。 我需要知道如何从这个应用程序写入文件

我包括了这些标题:windows.h、stdlib.h、string.h和tchar.h

我编写了一个非常简单的hello world应用程序,它运行得很好

但当我尝试包括iostream和fstream时 在我的项目中,编译器给了我以下错误

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(21): error C2039: 'abort' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(21): error C2873: 'abort' : symbol cannot be used in a using-declaration
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(24): error C2039: 'exit' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(24): error C2873: 'exit' : symbol cannot be used in a using-declaration
IntelliSense: the global scope has no "abort"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  21  13  
IntelliSense: the global scope has no "exit"    c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  24  13  
当我包括fstream.h时,我得到:

error C1083: Cannot open include file: 'fstream.h': No such file or directory   c:\users\user\documents\visual studio 2010\projects\helloworld\helloworld\main.cpp  5   1   helloworld
IntelliSense: cannot open source file "fstream.h" c:\users\user\documents\visual studio 2010\projects\helloworld\helloworld\main.cpp    5   1   helloworld
iostream.h也是这样


为什么会发生这些错误?

可能是您编写了
\include“iostream”
而不是
\include
可能是您编写了
\include“iostream”

而不是
\include
可能会有所帮助。。试着检查你的错误原因


这可能会有帮助。。试着检查你的错误原因


< C++ > C++ >使用< <代码> <代码>代替<代码> <代码> >代码> <代码>代替<代码> <代码>(假设您是C风格字符串)。如果您想要C++ STD::字符串,请使用<代码> <代码> [没有<代码> .H/COD> >


<> >使用<代码> >代码>,< <代码> > />代码>

< p> >,使用< <代码> <代码>代替<代码> <代码> >代码> <代码>代替<代码> <代码>(假设您是C++样式字符串)。如果您想要C++ STD::字符串,请使用<代码> <代码> [没有<代码> .h >


您应该使用
,而不是

请检查您的:

#包括“stdafx.h”

是您
.cpp
文件的第一个包含项

在此之后写下其他内容:

#include "stdafx.h"
#include <iostream>
// ... and so on

int main(...) {

}
#包括“stdafx.h”
#包括
//……等等
int main(…){
}

…这是Microsoft编译器经常出现的错误(请参阅)。

请检查您的:

#包括“stdafx.h”

是您
.cpp
文件的第一个包含项

在此之后写下其他内容:

#include "stdafx.h"
#include <iostream>
// ... and so on

int main(...) {

}
#包括“stdafx.h”
#包括
//……等等
int main(…){
}
…这是Microsoft编译器经常犯的错误(请参阅)