RWCString 定义 memeroy leak
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                RWCString 定义 memeroy leak
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                代碼截取片段:
testDefs.hh
1 class testDefs 2 { 3 public: 4 static const RWCString testStr; 5 };testDefs.cc
const RWCString testDefs::testStr = "test";報錯如下:
具體為什么會這樣報錯我是不知道的。有沒有大神來解釋下?
?
解決的辦法就比較簡單了,
直接用 char * 來代替 RWCString 即可。 如果使用的是 std::string, 那么產生的報錯就會更多。
表示很是疑惑。
?
解決的代碼片段:
testDefs.hh
?
class testDefs { public:static const char *testStr; };?
?
?
testDefs.cc
?
const char *testDefs::testStr = "test";?
轉載于:https://www.cnblogs.com/AndyStudy/p/6285750.html
總結
以上是生活随笔為你收集整理的RWCString 定义 memeroy leak的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: C++设计模式-Decorator装饰模
- 下一篇: [Python]项目打包:5步将py文件
