首页云计算 正文

C++的errorC2039和C2679的解决

2024-11-19 6 0条评论
  1. 首页
  2. 证书相关
  3. C++的errorC2039和C2679的解决

C++的errorC2039和C2679的解决

发布日期:2017-04-13

菜鸟最近接触C++,遇到了两个问题,记下来解决办法。

这里贴出练习的代码

#include “stdafx.h”
//#include <iostream>
//#include <string>
#include “windows.h”

class Hello{
public:
void sayHello(){
printf(“Hello jikexueyuan\n”);
}

void sayHello(std::string name){
std::string str = “Hello “;
str += name;
std::cout << str << “\n”;
}
};

运行之后提示错误:
错误 1 error C2039: “string”: 不是“std”的成员
于是我把#include <iostream>加到了全部代码的前面,但是发现依然有错误C2039,但是在错误C2039之前有一个warning
警告 1 warning C4627: “#include <iostream>”: 在查找预编译头使用时跳过
后来发现,#include <iostream>和#include “stdafx.h”是有先后顺序的,而且#include “stdafx.h”需要放到全部代码的前面。
调整了顺序之后再次运行,这次之前的错误没有了,但是有新的错误
错误 1 error C2679: 二进制“<<”: 没有找到接受“std::string”类型的右操作数的运算符(或没有可接受的转换)
百度之后在前面加上#include <string>解决了这个问题。

上一篇:什么是runtime error r6034 和如何修复?

下一篇:Tomcat中JVM内存溢出及合理配置

相关新闻

  • SSL证书对网站访问速度有影响吗
  • 个人隐私数据泄露有哪些危害?如何预防?
  • 部署SSL证书有哪些常见的错误
  • 国际证书、国产证书和国密证书
  • 游戏开发为什么离不开代码签名?
  • 僵尸网络攻击手法与防范方式
  • SSL证书助力保障网络数据安全
  • 网站加密与不加密区别
  • SSL证书有哪些类型和价格差异
  • ca机构颁发的证书包括那些内容呢?
文章版权及转载声明

本文作者:admin 网址:http://news.edns.com/post/113071.html 发布于 2024-11-19
文章转载或复制请以超链接形式并注明出处。

取消
微信二维码
微信二维码
支付宝二维码