入门问题,请帮忙

hexinyu2005 2006-05-09 11:44:41
#include "stdafx.h"
#include "iostream.h"
#include "cstring.h"
#include "fstream.h"

为什么会这样报错:

E:\CTest\ConTest\ConTest.cpp(4) : fatal error C1083: Cannot open include file: 'cstring.h': No such file or directory
Error executing cl.exe.
...全文
211 11 打赏 收藏 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
hlidea 2006-05-09
  • 打赏
  • 举报
回复
#include <string>
using namespace std;
应该可以了
一条晚起的虫 2006-05-09
  • 打赏
  • 举报
回复
#include <string>
hexinyu2005 2006-05-09
  • 打赏
  • 举报
回复
还是不行呀

#include "stdafx.h"
#include "iostream.h"
#include "fstream.h"
#include "string.h"

using namespace std;


int main(int argc, char* argv[])
{

ifstream infile("abc.txt");
string strfile = "";
//char c;
//for (c = infile.get(); !infile.eof(); c = infile.get())
//strfile += c;
//infile.clear();
//infile.close();

return 0;
}

ouyh12345 2006-05-09
  • 打赏
  • 举报
回复
#include <string>
using namespace std;
hexinyu2005 2006-05-09
  • 打赏
  • 举报
回复
string strfile = "";

这句会出错

E:\CTest\ConTest\ConTest.cpp(33) : error C2065: 'string' : undeclared identifier
E:\CTest\ConTest\ConTest.cpp(33) : error C2146: syntax error : missing ';' before identifier 'strfile'
E:\CTest\ConTest\ConTest.cpp(33) : error C2065: 'strfile' : undeclared identifier
E:\CTest\ConTest\ConTest.cpp(33) : error C2440: '=' : cannot convert from 'char [1]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.
一条晚起的虫 2006-05-09
  • 打赏
  • 举报
回复
#include <string>
hexinyu2005 2006-05-09
  • 打赏
  • 举报
回复
string strfile = "";

因为我在程序中要用到字符窜
hexinyu2005 2006-05-09
  • 打赏
  • 举报
回复
是什么问题,应该怎么做
一条晚起的虫 2006-05-09
  • 打赏
  • 举报
回复
o such file or directory,cstring.h不存在
hlidea 2006-05-09
  • 打赏
  • 举报
回复

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>

using namespace std;


int main(int argc, char* argv[])
{

ifstream infile("abc.txt");
string strfile = "";
//char c;
//for (c = infile.get(); !infile.eof(); c = infile.get())
//strfile += c;
//infile.clear();
//infile.close();

return 0;
}
这是直接改的你的代码,再不行,砸电脑。。。。我在自己机上一点问题没有,注意几个地方,第一,要用尖括号不要用引号;第二,不要加上.h
hexinyu2005 2006-05-09
  • 打赏
  • 举报
回复
还是不行呀

16,550

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧