I tried to create a simple Tizen v2.4 UI Builder App using Tizen Studio 1.0.1. The application consists of just a single view with 1 button. In the button's event listener I would like to invoke a new class that is made of C++ code.
void view1_btnTry_onclicked(uib_view1_view_context *vc, Evas_Object *obj, void *event_info)
{
TestClass* tc = testClassInstance();
}
So I created 1 header file named TestClass.hpp
and 1 source file TestClass.cpp
. Both of them are placed within the src/event_handler
folder.
Here is the content of TestClass.hpp
:
#ifndef EVENT_HANDLER_TESTCLASS_HPP_
#define EVENT_HANDLER_TESTCLASS_HPP_
class TestClass
{
public:
TestClass();
virtual ~TestClass();
};
TestClass* testClassInstance();
#endif /* EVENT_HANDLER_TESTCLASS_HPP_ */
And this is the content of TestClass.cpp
, just a factory method, 1 empty ctor & 1 dtor:
#include <stdlib.h>
#include "TestClass.hpp"
static TestClass* instance;
TestClass* TestClass::testClassInstance()
{
if(instance == null)
instance = new TestClass;
return instance;
}
TestClass::TestClass()
{
}
TestClass::~TestClass()
{
}
#endif /* EVENT_HANDLER_TESTCLASS_HPP_ */
I included the header file in uib_view1_event_handler.c
using #import "TestClass.hpp"
. However when I performed build, these errors occured:
In file included from ../src/event_handler/uib_view1_event_handler.c:11:
../src/event_handler/TestClass.hpp:11:1: error: unknown type name 'class'
class TestClass
^
../src/event_handler/TestClass.hpp:11:16: error: expected ';' after top level declarator
class TestClass
If the header is included somwhere, the error always persist.
I have tried to: Change header extension to .c
, change compiler dialect to C++11 standard, and move the include
to inc/app_main.h
But the result is still the same. Could you please give some enlightenments?
Aucun commentaire:
Enregistrer un commentaire