新手问题

sunny_wz 2003-01-08 10:07:14
我刚学用泛型编程,定义一个最简单的向量,但用VC6编译通不过
我的程序很简单,如下:
# include <vector>
void main()
{
int num[3] = {0,1,2};
vector<int> ivec(num,num+3);
}
但编译时显示如下:
c:\program files\microsoft visual studio\vc98\include\new(9) : warning C4601: #pragma push_macro : 'new' is not currently defined as a macro
c:\program files\microsoft visual studio\vc98\include\new(55) : error C2143: syntax error : missing ')' before '...'
c:\program files\microsoft visual studio\vc98\include\new(55) : error C2143: syntax error : missing ';' before '...'
c:\program files\microsoft visual studio\vc98\include\new(55) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
请教各位兄弟们这该怎么解决,用什么编译器更适合泛型编程。
...全文
98 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
happy2program 2003-01-09
  • 打赏
  • 举报
回复
# include <vector>
void main()
{
int num[3] = {0,1,2};
std::vector<int> ivec(num,num+3);
}
VC++6.0企业版
sunny_wz 2003-01-08
  • 打赏
  • 举报
回复
我也这么认为,我装的VC6本来不包含泛型方面的。H文件,
我把VC安装光盘上INCLUDE目录下所有的.H拷贝到VC安装的INCLUDE目录里
但我不知这样做对不对,不知你们是怎么装的
windcsn 2003-01-08
  • 打赏
  • 举报
回复
可能是编译器的问题,我在vc6下试一点问题都没有
sunny_wz 2003-01-08
  • 打赏
  • 举报
回复
to windcsn(风吹吹风)
我试过,还是同样问题
IamBM 2003-01-08
  • 打赏
  • 举报
回复
gz
windcsn 2003-01-08
  • 打赏
  • 举报
回复
# include <vector>
using namespace std;
试试

24,860

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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