In msvc, I have functions like this and it builds but in gcc it doesnt like it.
void classname::a(std::string &text)
{
stdStringFromClass = text;
}
void classname::b(char *text)
{
a(std::string(text));
}
The issue here is in the &, gcc I think is worried that since I just created that std::string, that passing by reference is risky, so it does not build, but msvc doesnt even warn me.
Why is this incorrect c++ to gcc I keep hearing that msvc is stricter than gcc.
Thanks
The error
AguiWidgetBase.cpp: In member function ‘void AguiWidgetBase::setText(char*)’:
AguiWidgetBase.cpp:91:27: error: no matching function for call to ‘AguiWidgetBase::setText(std::string)’
AguiWidgetBase.cpp:80:6: note: candidates are: void AguiWidgetBase::setText(std::string&)
AguiWidgetBase.cpp:88:6: note: void AguiWidgetBase::setText(char*)
would this be okay?
void classname::a(std::string &text)
{
stdStringFromClass = text;
}
void classname::b(char *text)
{
std::string k = text;
a(k);
}