Languages

Menu
Sites
Language
C++ code mixed with ANSI C

I wonder is it possible to compile C++ code snippet under Tizen IDE.

I mean to add and compile a library coded in C++.  As we know since 2015 the main native language is ANSI C.

I tried to add class to Native project but is not parsed correctly by Tizen env.

Is there any way to configure Tizen Native project to accept C++ code in Tizen IDE?

I don't want to use c++ to create UI or use specified Tizen features.

 

thanks

slaw

Responses

6 Replies
Yasin Ali

Hi~,

You may try in the following way,

1. Take a project like BasicUI and change its source file extension from .c to .cpp

2. Goto project properties => C/C++ Build =>settings => C++ Compiler => Dialect =>

Language Selection => C++11(select)

Also here goto Tizen Settings => Toolchain Info => GCC 4.9(select)

3. Add a class header and class source in inc folder of the opened project

4. Include that header in your main project source file( that resides in src folder)

Now create an object of your class and use it.

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

Slawek Kowalski

Thanks for your quick reply. I did as you said. I have compilation error at class Line {.

Description    Resource    Path    Location    Type
expected '=', ',', ';', 'asm' or '__attribute__' before ':' token    line.h    /TestApp/inc    line 11    C/C++ Problem

Description    Resource    Path    Location    Type
expected class-name before '{' token    test.h    /TestApp/inc    line 11    C/C++ Problem

 

This simple class code:

class Line { // line 11, compiler stops here
   public:
      void setLength(double len);
      double getLength( void );
      Line();
   private:
      double length;
};

It is test app. I could use C to gain this result but as I said before I need to import external C++ code.

 

Yasin Ali

In my setup I could successfully import external C++ code.

Yasin Ali

Have you succeded yet?

Slawek Kowalski

I have left the issue for some time. Too much work in office last days. I am going back to Tizen in few days. Thanks for your help.