C++ 在我的eclipsec++;ide,为什么可以';与字符串相关的函数是否可以解析?
我有一段代码:C++ 在我的eclipsec++;ide,为什么可以';与字符串相关的函数是否可以解析?,c++,eclipse,string,ubuntu,C++,Eclipse,String,Ubuntu,我有一段代码: #include <iostream> #include <string> int main() { std::cout << "!!!Hello World " << std::endl; std::string a = "aa"; std::string b; b = "bb"; std::string c = strcat(a,b); std::cout << c
#include <iostream>
#include <string>
int main() {
std::cout << "!!!Hello World " << std::endl;
std::string a = "aa";
std::string b;
b = "bb";
std::string c = strcat(a,b);
std::cout << c << std::endl;
return 0;
}
我不知道为什么会这样
strcat
是一个在char*
上工作的C函数。您需要#包含
无论如何,您所做的都是错误的:您没有将std:string
参数传递给strcat
使用c=a+b
那些函数属于
。不要使用std::endl
,除非你需要额外的东西<代码>“\n”
开始新行。
#include <string>