编译错误:语法支持问题
src/generate/t_rb_generator.cc: In member function ‘virtual void t_rb_generator::generate_enum(t_enum*)’:
src/generate/t_rb_generator.cc:359:11: error: operands to ?: have different types ‘bool’ and ‘std::basic_ostream<char>’
first ? first = false : f_types_ << ", ";
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/generate/t_rb_generator.cc:369:11: error: operands to ?: have different types ‘bool’ and ‘std::basic_ostream<char>’
first ? first = false : f_types_ << ", ";
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [Makefile:749: thrift-t_rb_generator.o] Error 1
make[3]: Leaving directory '/home/dong/thrift-0.9.0/compiler/cpp'
解决
将 first ? first = false : f_types_ << ", ";
修改为
if(first)
{
first = false :
}
else
{
f_types_ << ", ";
}