语言

Menu
Sites
Language
DALi 에서 string 의 사용

달리 앱에서 string 에 int형 변수를 포함시키고 싶습니다.

string 을 편집하는 다른 방법이 있나요?(stdlib의 itoa 같은 함수가 있나요?)

void HelloWorldExample::Create( Application& application )
{
  TableView tableView = TableView::New( 4, 4 );
  tableView.SetKeyboardFocusable( true );
  tableView.SetParentOrigin( ParentOrigin::CENTER );
  tableView.SetSize( 300, 300 );

  for( int row = 0; row < 4; ++row )
  {
    for( int col = 0; col < 4; ++col )
    {
      std::ostringstream str;
      str << row << "-" << col;
      TextLabel textLabel = TextLabel::New( str.str() );
      textLabel.SetKeyboardFocusable( true );
      textLabel.SetBackgroundColor( Color::WHITE );
      tableView.AddChild( textLabel, TableView::CellPosition( row, col ) );
    }
  }
  Stage::GetCurrent().Add( tableView );
}

위 예제를 적용하려고하면 implicit instantiation of undefined template 'std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'라는 에러를  발생시킵니다.

编辑者为: SEHEUM LEE 01 6月, 2016

响应

1 回复
Masum Talukder

Hello,

The error you are facing beacuse of the missing header file for 'ostringstream'. You have to add the following header file:

#include <sstream>

I hope it will resolve your problem.

 

If you find my post helpful for you, please mark it as the Best Answer to promote this post to others.