64位程式連接了mitab_i.lib
當程式中出現兩個字串相加
string a = "hello" + "World!"
就會崩潰
uj5u.com熱心網友回復:
這個都編譯不過去的代碼,指標不能相加。字串相加需要其中一個為string型別
string a = string("hello") + "World!";
或
string a ="hello" + string("World!");
uj5u.com熱心網友回復:
編譯不過樓主能運行嗎??在其它環境編譯和運行都沒問題的
uj5u.com熱心網友回復:
好吧,我錯了。我想舉個例子,貽笑大方了
uj5u.com熱心網友回復:
不知道你用什么編譯器能編譯通過?
VS2008
#include<string>
using namespace std;
int main()
{
string a = "hello" + "World!";
}
error C2110: “+”: 不能添加兩個指標
uj5u.com熱心網友回復:
這個都編譯不過去的代碼,指標不能相加。
字串相加需要其中一個為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: “+”: 不能添加兩個指標
哦,我看錯了。
//這樣
string a = "hello" "World!";
//或者
string a = "hello"
"World!";
//都可以編譯通過的
uj5u.com熱心網友回復:
uj5u.com熱心網友回復:
當 txt 很長時 可以string a = "hello"
"World!"
“How are you?“
所有 引號 內 的 字串 會 合并 在一起!
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/156003.html
標籤:基礎類
上一篇:驅動程式啟動不了,The driver is marked as disabled(Start=4)in its service database entry
