vs2008 使用std::string 两个字符串相加崩溃 64位程序连接了mitab_i.lib当程序中出现两个字符串相加string a = "hello" + "World!"就会崩溃 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个都编译不过去的代码,指针不能相加。字符串相加需要其中一个为string类型string a = string("hello") + "World!";或string a ="hello" + string("World!"); 编译不过楼主能运行吗??在其它环境编译和运行都没问题的不知道你用什么编译器能编译通过?VS2008#include<string>using namespace std;int main(){ string a = "hello" + "World!";}error C2110: “+”: 不能添加两个指针 编译不过楼主能运行吗??在其它环境编译和运行都没问题的不知道你用什么编译器能编译通过?VS2008#include<string>using namespace std;int main(){ string a = "hello" + "World!";}error C2110: “+”: 不能添加两个指针哦,我看错了。//这样string a = "hello" "World!";//或者string a = "hello" "World!";//都可以编译通过的 当 txt 很长时 可以 string a = "hello" "World!" “How are you?“所有 引号 内 的 字符串 会 合并 在一起! MFC中进度条问题 关于Application.Quit的问题 如何解决这个问题? 如何在windows的桌面上创建个按钮? 如何检测线程没有响应? 谁能给我用VC++制作一个可以画任何直线的框架(可以保存)的原代码 以指针返回静态字符串,然后用ofstream输出时,可能会引起不正确的结果?为什么? 从class CCoolDialogBar : public CControlBar 派生 求救!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! vc6.0连接数据库 设置窗口大小的问题 如何实现“双击文件,自己编写的MFC对话框程序读取该文件”
字符串相加需要其中一个为string类型
string a = string("hello") + "World!";
或
string a ="hello" + string("World!");
编译不过楼主能运行吗??在其它环境编译和运行都没问题的
不知道你用什么编译器能编译通过?VS2008
#include<string>
using namespace std;
int main()
{
string a = "hello" + "World!";
}
error C2110: “+”: 不能添加两个指针
编译不过楼主能运行吗??在其它环境编译和运行都没问题的
不知道你用什么编译器能编译通过?VS2008
#include<string>
using namespace std;
int main()
{
string a = "hello" + "World!";
}
error C2110: “+”: 不能添加两个指针
哦,我看错了。
//这样
string a = "hello" "World!";
//或者
string a = "hello"
"World!";
//都可以编译通过的
string a = "hello"
"World!"
“How are you?“
所有 引号 内 的 字符串 会 合并 在一起!