VC6的工程在2003里怎么通不过 e:\code\test\test.cpp(6) : fatal error C1083: 无法打开包含文件:“iostream.h”: No such file or directory很简单的一个测试程序 另外 我想查一下VC的STRCPY这些函数的源代码 怎么找不到string.cpp这个文件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1. #include <iostream> 2005遵循了最新的C++标准,把C++头文件的后面的.h扩展名都去掉了2. CRT 函数的代码都在$(YOUR_2005_DIR)\VC\crt\src下面。你所说的strcpy的代码在$(YOUR_2005_DIR)\VC\crt\src\intel\strcat.asm中。 是2003 不是2005 去掉.h后 e:\code\test\test.cpp(44) : error C2065: “cout” : 未声明的标识符e:\code\test\test.cpp(44) : error C2065: “endl” : 未声明的标识符e:\code\test\test.cpp(46) : error C3861: “cout”: 即使使用参数相关的查找,也未找到标识符e:\code\test\test.cpp(46) : error C3861: “endl”: 即使使用参数相关的查找,也未找到标识符 这么一个简单的程序 执行时却出错 VC6里是正常的 void Reverse(char *str){ char c; char *p = str; char *s = str; int n = 0, m = 0; while(*p != 0) { n++; p++; } p--; n = (n-1)/2; while( m <= n ) { c = *(s+m); *(s+m) = *(p-m); *(p-m) = c; m++; }}int main(int argc, char* argv[]){ char *p = "abcdefg;"; cout << p << endl; Reverse(p); cout << p << endl;} char *p = "abcdefg;";是常量,是只读不可修改的,修改的话会报Access Violation。应该make一份copy再调你的Reverse函数。Main应该这样写:int main(int argc, char* argv[]){ char *p = strdup("abcdefg;"); cout << p << endl; Reverse(p); cout << p << endl; free(p);}我手头没有2003,但想来应该是2003和2005在对字符串常量的处理方式不同而造成的。其实2005这么做是正确的,可以发现更多问题。 Sorry,看错了,你说的是VC6上不出错,不是2003,不过道理是一样的 果然不过有个问题 char *p = "abcdefg;"; 这是常量 char *s = _strdup(p); 这却成了可变的 不都是 char * 关于Thread32First函数的疑问 WSAAsyncSelect模型编程,但是为什么CAsyncSocket::AttachHandle在msdn中查不到呢? 线程传递serversocket问题,急,拜托了,磕一个 求助呀,文本框怎么显示出带回车的文本 问个弱弱的问题有关《程序员》杂志的 江湖救急!宽带太他妈不好了. Win32计时器的使用问题 ........(菜菜的)从文件读入两行数据。。。。。。。。。。 请问高手? 又是一个关于网络编程的问题 哪里能买到设计模式原版? 今天看到一个flash还可以它来照大头贴是怎么做的哦
2005遵循了最新的C++标准,把C++头文件的后面的.h扩展名都去掉了2. CRT 函数的代码都在$(YOUR_2005_DIR)\VC\crt\src下面。你所说的strcpy的代码在$(YOUR_2005_DIR)\VC\crt\src\intel\strcat.asm中。
去掉.h后
e:\code\test\test.cpp(44) : error C2065: “cout” : 未声明的标识符
e:\code\test\test.cpp(44) : error C2065: “endl” : 未声明的标识符
e:\code\test\test.cpp(46) : error C3861: “cout”: 即使使用参数相关的查找,也未找到标识符
e:\code\test\test.cpp(46) : error C3861: “endl”: 即使使用参数相关的查找,也未找到标识符
void Reverse(char *str)
{
char c;
char *p = str;
char *s = str;
int n = 0, m = 0; while(*p != 0) {
n++;
p++;
}
p--;
n = (n-1)/2;
while( m <= n )
{
c = *(s+m);
*(s+m) = *(p-m);
*(p-m) = c;
m++;
}
}int main(int argc, char* argv[])
{
char *p = "abcdefg;";
cout << p << endl;
Reverse(p);
cout << p << endl;
}
Main应该这样写:
int main(int argc, char* argv[])
{
char *p = strdup("abcdefg;"); cout << p << endl;
Reverse(p);
cout << p << endl; free(p);
}我手头没有2003,但想来应该是2003和2005在对字符串常量的处理方式不同而造成的。其实2005这么做是正确的,可以发现更多问题。
不过有个问题 char *p = "abcdefg;"; 这是常量
char *s = _strdup(p); 这却成了可变的 不都是 char *