Can't export class.

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
nicolay
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Oct 21, 2013 11:36 am

Can't export class.

Post by nicolay »

1) I read this topichttp://forums.wxwidgets.org/viewtopic.p ... pp#p155595, and i try export class
2) in wxGuiPluginBase I create new class, name TestClassForExport
3) Add my class files to MakeList
3) Declare in .cpp files this:

Code: Select all

#include <wx/listimpl.cpp>
    WX_DEFINE_LIST(MyList);
4)I declare in .h file this:

Code: Select all

WX_DECLARE_USER_EXPORTED_LIST(TestClassForExport, IFloorTaskTimeList,DEMO_API);
5) I try wxWidgets from Repo, and wxWidgets-2.9.5 gcc4.7

Code: Select all

#include "TestClassForExport.h"
#include <wx/listimpl.cpp>
WX_DEFINE_LIST(IFloorTaskTimeList);

TestClassForExport::TestClassForExport()
{
    //ctor
}

TestClassForExport::~TestClassForExport()
{
    //dtor
}

Code: Select all

#ifndef TESTCLASSFOREXPORT_H
#define TESTCLASSFOREXPORT_H
#include "../wxNonGuiPluginBase/Declarations.h"


class TestClassForExport
{
public:
    TestClassForExport();
    virtual ~TestClassForExport();
protected:
private:
};
WX_DECLARE_USER_EXPORTED_LIST(TestClassForExport, IFloorTaskTimeList,DEMO_API);
#endif // TESTCLASSFOREXPORT_H


and i see this error:

-------------- Build: all in wxModularHost ---------------

Using makefile: Makefile
[ 12%] Built target wxModularCore
[ 16%]
Building CXX object //home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/Linux/Release/CMakeFiles/wxGuiPluginBase.dir/TestClassForExport.cpp.o
In file included from //home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/TestClassForExport.cpp:1:0:
//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/TestClassForExport.h:14:51: ошибка: «IFloorTaskTimeList» не был декларирован
//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/TestClassForExport.h:14:78: ошибка: expected identifier before «)» token
//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/TestClassForExport.h:14:79: ошибка: expected constructor, destructor, or type conversion before «;» token
//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/TestClassForExport.cpp:5:1: ошибка: «wxIFloorTaskTimeListNode» не был декларирован
//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/TestClassForExport.cpp: В функции «void DeleteData()»:
//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/TestClassForExport.cpp:5:1: ошибка: нет декларации «_WX_LIST_ITEM_TYPE_IFloorTaskTimeList» в этой области видимости
//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/TestClassForExport.cpp:5:1: ошибка: expected primary-expression before «)» token
//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/TestClassForExport.cpp:5:1: ошибка: expected «;» before «GetData»
make[2]: *** [//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/Linux/Release/CMakeFiles/wxGuiPluginBase.dir/TestClassForExport.cpp.o] Ошибка 1
make[1]: *** [//home/nicolay/RaspberryPi/wxModularApp/wxGuiPluginBase/Linux/Release/CMakeFiles/wxGuiPluginBase.dir/all] Ошибка 2
make: *** [all] Ошибка 2
Process terminated with status 2 (0 minutes, 0 seconds)
7 errors, 0 warnings
What is Wrong?
nicolay
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Oct 21, 2013 11:36 am

Re: Can't export class.

Post by nicolay »

this problem is gone, i dont understand why.
but i have new problem.
In export class i have the enum :
enum EffectType
{
Service,
Window
};
i try:
MyClassName::EffectType::Window

1)in Windows system it's working
2)in Linux(Ubuntu) i have error:
ошибка: «MyClassName::EffectType» is not a class or namespace|
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Can't export class.

Post by doublemax »

Is this related to the "exported class" problem or is it a general compiler problem under Linux (even if you don't work with an exported class) ?
Use the source, Luke!
nicolay
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Oct 21, 2013 11:36 am

Re: Can't export class.

Post by nicolay »

You're right, not working without export.
I try

Code: Select all

MyClassName::Window

and it's good. WHat is it?
nicolay
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Oct 21, 2013 11:36 am

Re: Can't export class.

Post by nicolay »

thank you for help)))
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Can't export class.

Post by doublemax »

So is this solved? Because i didn't really understand what you wrote.
Use the source, Luke!
nicolay
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Oct 21, 2013 11:36 am

Re: Can't export class.

Post by nicolay »

Yes it is. After your post i I looked others classes, very oft "enum" have no name. In my class i try not write enum name. This works.
MyClassName::EffectType::Window - not work
MyClassName::Window - working
Post Reply