2013-11-21 130 views
-2

几个答案(如splitting int from a string)提议C++字符串分割到数组

#include <sstream> 

Unforunately,没有编制,我(错误 “sstream:没有这样的文件或目录”)。 我发现我可以使用

#include <strstream> 

改为。好吧,现在,与

std::string s = "100 123 42"; 
std::istringstream is(s); 

我得到了“未声明的变量istringstream”(首次在这里使用)“。 好吧,尝试:

std::istrstream is(s); 

几乎可以。错误:“没有匹配函数调用`istrstream :: istrstream(string &)'”。

std::istrstream is(); 

所以我觉得我附近某处:)缺少了什么: 但至少它编译?

+2

'的#include ',''不赞成或者是过时的。无论如何''是你想要的。 – john

+1

您必须使用'#include '而不是'#include ''? –

+0

[什么不能编译?](http://ideone.com/ERBFqX) – P0W

回答

0

好的,我安装了代码块,并使用了mingr32-g ++编译器。 我现在的建设者配置:

{ 
"cmd": ["mingw32-g++", "${file}", "-o", "${file_path}/${file_base_name}"], 
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", 
"working_dir": "${file_path}", 
"selector": "source.c, source.c++", 
"path":"C:/Program Files (x86)/CodeBlocks/MinGW/bin", 
    "variants": 
    [ 
     { 
      "name": "Run", 
      "cmd": ["g++", "$file", "-o", "$file_base_name", "&&", "$file_path/$file_base_name"], 
      "shell": true 
     } 
    ] 
}