How to use C++ string and Tizen::Base::String in a Tizen native application?

Original Created Jan 06, 2017 | Regeneration Apr 22, 2026

I'm developing a Tizen native application using Tizen Studio with main.c and main.h files. Currently, I'm only using unsigned char for text handling, but I'd like to utilize both C++ string and Tizen::Base::String.

I have several specific questions:

  1. How can I use both C++ string and Tizen::Base::String in my project?
  2. When I try to change main.c to main.cpp, I encounter errors. Is there a proper way to convert from C to C++?
  3. Does Tizen::Base::String support C, or is it only for C++?
  4. Is Tizen::Base::String a class like Android and C++ strings? Where can I find documentation about Tizen variable types?

Problem Understanding

The user wants to use C++ string functionality in a Tizen native application that's currently written in C. They're encountering difficulties when trying to switch from C to C++ and need clarification about string handling options in Tizen.

Solution Methods

  1. Using C++ in Tizen Native Applications:

    • Tizen primarily uses C for native applications, but C++ can be used with proper configuration
    • To use C++: a. Rename your source files to use .cpp extension b. Configure the project settings:
      • Right-click project → Properties → C/C++ Build → Settings → Tool Settings → C++ Compiler → Dialect
      • Select C++11 from "Language Standard"
      • Go to Properties → C/C++ Build → Tizen Settings → Platform
      • In "Toolchain Information", select either GCC-4.9 or LLVM GCC-4.9 from "Name" dropdown
  2. String Handling Options:

    • For C development: Use standard C string functions (strcpy, strlen, etc.) with char arrays
    • For C++ development: You can use std::string or Tizen::Base::String
    • Tizen::Base::String is a C++ class and not available for pure C development
  3. Documentation Resources:

    • For Tizen::Base::String and other C++ classes, refer to the official documentation at samsungtizenos.com
    • The documentation primarily shows methods, but you can find class definitions there as well

Additional Tips

  • When using C strings, remember to properly manage memory allocation and deallocation
  • For Unicode support, consider using Tizen's i18n libraries
  • If you're new to Tizen development, examine the sample applications in Tizen Studio under Mobile UI segment for reference implementations

Customize your cookie preferences

You can enable or disable non-essential cookies. Essential cookies are always on to ensure the site works properly and to keep you signed in.

Necessary

These cookies are necessary for the website to function properly and cannot be switched off. They help with things like logging in and setting your privacy preferences.

Always on

Analytics

These cookies help us improve the site by tracking which pages are most popular and how visitors move around the site.

Enable analytics cookies
Public Forum Public Forum
Employees only. Please sign in with your company account.