I'm trying to compile a HaxeUI app on Mac OS with the latest version El Capitan.
The list of Haxe libraries installed, with versions:
$ haxelib list
actuate: [1.8.6]
box2d: [1.2.3]
format: [3.2.1]
haxeui-file-dialogs: [0.1.1]
haxeui-rich-text: [0.1.2]
haxeui: [1.7.20]
hscript: [2.0.5]
hxcpp: [3.2.193]
layout: [1.2.1]
lime-samples: [2.6.0]
lime: [2.7.0]
nme: [5.5.7]
openfl-samples: [3.3.1]
openfl: [3.4.0]
swf: [2.1.3]
yagp: [1.1.4]
While trying to compile with openfl build mac, I get the following errors and warnings:
./src/haxe/ui/toolkit/core/renderers/ItemRenderer.cpp:161:15: error: allocating an object of abstract class type '::haxe::ui::toolkit::core::interfaces::IStyleableDisplayObject_delegate_<ItemRenderer_obj>'
{ return new ::haxe::ui::toolkit::core::interfaces::IStyleableDisplayObject_delegate_< ItemRenderer_obj >(this); }
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:127:16: note: unimplemented pure virtual method 'addEventListener' in 'IStyleableDisplayObject_delegate_'
virtual Void addEventListener( ::String type,Dynamic listener,hx::Null< bool > useCapture,hx::Null< int > priority,hx::Null< bool > useWeakReference)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:128:17: note: unimplemented pure virtual method 'addEventListener_dyn' in 'IStyleableDisplayObject_delegate_'
virtual Dynamic addEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:129:16: note: unimplemented pure virtual method 'dispatchEvent' in 'IStyleableDisplayObject_delegate_'
virtual bool dispatchEvent( ::openfl::_legacy::events::Event event)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:130:17: note: unimplemented pure virtual method 'dispatchEvent_dyn' in 'IStyleableDisplayObject_delegate_'
virtual Dynamic dispatchEvent_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:131:16: note: unimplemented pure virtual method 'hasEventListener' in 'IStyleableDisplayObject_delegate_'
virtual bool hasEventListener( ::String type)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:132:17: note: unimplemented pure virtual method 'hasEventListener_dyn' in 'IStyleableDisplayObject_delegate_'
virtual Dynamic hasEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:133:16: note: unimplemented pure virtual method 'removeEventListener' in 'IStyleableDisplayObject_delegate_'
virtual Void removeEventListener( ::String type,Dynamic listener,hx::Null< bool > useCapture)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:134:17: note: unimplemented pure virtual method 'removeEventListener_dyn' in 'IStyleableDisplayObject_delegate_'
virtual Dynamic removeEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:135:16: note: unimplemented pure virtual method 'willTrigger' in 'IStyleableDisplayObject_delegate_'
virtual bool willTrigger( ::String type)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:136:17: note: unimplemented pure virtual method 'willTrigger_dyn' in 'IStyleableDisplayObject_delegate_'
virtual Dynamic willTrigger_dyn()=0;
^
./src/haxe/ui/toolkit/core/renderers/ItemRenderer.cpp:165:15: error: allocating an object of abstract class type '::haxe::ui::toolkit::core::interfaces::IComponent_delegate_<ItemRenderer_obj>'
{ return new ::haxe::ui::toolkit::core::interfaces::IComponent_delegate_< ItemRenderer_obj >(this); }
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:127:16: note: unimplemented pure virtual method 'addEventListener' in 'IComponent_delegate_'
virtual Void addEventListener( ::String type,Dynamic listener,hx::Null< bool > useCapture,hx::Null< int > priority,hx::Null< bool > useWeakReference)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:128:17: note: unimplemented pure virtual method 'addEventListener_dyn' in 'IComponent_delegate_'
virtual Dynamic addEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:129:16: note: unimplemented pure virtual method 'dispatchEvent' in 'IComponent_delegate_'
virtual bool dispatchEvent( ::openfl::_legacy::events::Event event)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:130:17: note: unimplemented pure virtual method 'dispatchEvent_dyn' in 'IComponent_delegate_'
virtual Dynamic dispatchEvent_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:131:16: note: unimplemented pure virtual method 'hasEventListener' in 'IComponent_delegate_'
virtual bool hasEventListener( ::String type)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:132:17: note: unimplemented pure virtual method 'hasEventListener_dyn' in 'IComponent_delegate_'
virtual Dynamic hasEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:133:16: note: unimplemented pure virtual method 'removeEventListener' in 'IComponent_delegate_'
virtual Void removeEventListener( ::String type,Dynamic listener,hx::Null< bool > useCapture)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:134:17: note: unimplemented pure virtual method 'removeEventListener_dyn' in 'IComponent_delegate_'
virtual Dynamic removeEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:135:16: note: unimplemented pure virtual method 'willTrigger' in 'IComponent_delegate_'
virtual bool willTrigger( ::String type)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:136:17: note: unimplemented pure virtual method 'willTrigger_dyn' in 'IComponent_delegate_'
virtual Dynamic willTrigger_dyn()=0;
^
./src/haxe/ui/toolkit/core/renderers/ItemRenderer.cpp:171:15: error: allocating an object of abstract class type '::haxe::ui::toolkit::core::interfaces::IStateComponent_delegate_<ItemRenderer_obj>'
{ return new ::haxe::ui::toolkit::core::interfaces::IStateComponent_delegate_< ItemRenderer_obj >(this); }
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:127:16: note: unimplemented pure virtual method 'addEventListener' in 'IStateComponent_delegate_'
virtual Void addEventListener( ::String type,Dynamic listener,hx::Null< bool > useCapture,hx::Null< int > priority,hx::Null< bool > useWeakReference)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:128:17: note: unimplemented pure virtual method 'addEventListener_dyn' in 'IStateComponent_delegate_'
virtual Dynamic addEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:129:16: note: unimplemented pure virtual method 'dispatchEvent' in 'IStateComponent_delegate_'
virtual bool dispatchEvent( ::openfl::_legacy::events::Event event)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:130:17: note: unimplemented pure virtual method 'dispatchEvent_dyn' in 'IStateComponent_delegate_'
virtual Dynamic dispatchEvent_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:131:16: note: unimplemented pure virtual method 'hasEventListener' in 'IStateComponent_delegate_'
virtual bool hasEventListener( ::String type)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:132:17: note: unimplemented pure virtual method 'hasEventListener_dyn' in 'IStateComponent_delegate_'
virtual Dynamic hasEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:133:16: note: unimplemented pure virtual method 'removeEventListener' in 'IStateComponent_delegate_'
virtual Void removeEventListener( ::String type,Dynamic listener,hx::Null< bool > useCapture)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:134:17: note: unimplemented pure virtual method 'removeEventListener_dyn' in 'IStateComponent_delegate_'
virtual Dynamic removeEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:135:16: note: unimplemented pure virtual method 'willTrigger' in 'IStateComponent_delegate_'
virtual bool willTrigger( ::String type)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:136:17: note: unimplemented pure virtual method 'willTrigger_dyn' in 'IStateComponent_delegate_'
virtual Dynamic willTrigger_dyn()=0;
^
./src/haxe/ui/toolkit/core/renderers/ItemRenderer.cpp:173:15: error: allocating an object of abstract class type '::haxe::ui::toolkit::core::interfaces::IDisplayObjectContainer_delegate_<ItemRenderer_obj>'
{ return new ::haxe::ui::toolkit::core::interfaces::IDisplayObjectContainer_delegate_< ItemRenderer_obj >(this); }
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:127:16: note: unimplemented pure virtual method 'addEventListener' in 'IDisplayObjectContainer_delegate_'
virtual Void addEventListener( ::String type,Dynamic listener,hx::Null< bool > useCapture,hx::Null< int > priority,hx::Null< bool > useWeakReference)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:128:17: note: unimplemented pure virtual method 'addEventListener_dyn' in 'IDisplayObjectContainer_delegate_'
virtual Dynamic addEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:129:16: note: unimplemented pure virtual method 'dispatchEvent' in 'IDisplayObjectContainer_delegate_'
virtual bool dispatchEvent( ::openfl::_legacy::events::Event event)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:130:17: note: unimplemented pure virtual method 'dispatchEvent_dyn' in 'IDisplayObjectContainer_delegate_'
virtual Dynamic dispatchEvent_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:131:16: note: unimplemented pure virtual method 'hasEventListener' in 'IDisplayObjectContainer_delegate_'
virtual bool hasEventListener( ::String type)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:132:17: note: unimplemented pure virtual method 'hasEventListener_dyn' in 'IDisplayObjectContainer_delegate_'
virtual Dynamic hasEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:133:16: note: unimplemented pure virtual method 'removeEventListener' in 'IDisplayObjectContainer_delegate_'
virtual Void removeEventListener( ::String type,Dynamic listener,hx::Null< bool > useCapture)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:134:17: note: unimplemented pure virtual method 'removeEventListener_dyn' in 'IDisplayObjectContainer_delegate_'
virtual Dynamic removeEventListener_dyn()=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:135:16: note: unimplemented pure virtual method 'willTrigger' in 'IDisplayObjectContainer_delegate_'
virtual bool willTrigger( ::String type)=0;
^
include/haxe/ui/toolkit/core/interfaces/IDisplayObject.h:136:17: note: unimplemented pure virtual method 'willTrigger_dyn' in 'IDisplayObjectContainer_delegate_'
virtual Dynamic willTrigger_dyn()=0;
^
4 errors generated.
make: *** [build-haxe-i386] Error 1
** BUILD FAILED **
The following build commands failed:
ExternalBuildToolExecution Build\ Haxe
(1 failure)
Can anybody help me? How do I get rid of these problems?
I have been using Haxe-UI for some time now, and from what I know you have to include haxelib install haxeui-core. That said, I'm on Linux.
Related
Hello I am getting the above error for the subscriber class I created as following:
The error seems in the write function of the class but I am not sure what I am missing in the function.
`uvm_analysis_imp_decl(_bfm2dut_change)
class checker_subscriber extends uvm_subscriber;
uvm_analysis_imp_bfm2dut_change#(setup_pcie_pkg::dut2bfm_hdr_trans, checker_subscriber) bfm2dut_change_ap;
`uvm_component_utils(checker_subscriber)
extern function new(string name = "checker_subscriber", uvm_component parent = null);
// BUILD,CONNECT and RUN Phase
extern virtual function void build_phase(uvm_phase phase);
extern virtual function void connect_phase(uvm_phase phase);
extern virtual task run_phase(uvm_phase phase);
// write function xal2fb
virtual function void write_xal2fb_change(xal2fb_uvc::transaction tr);
xal2fb_uvc::tx_default_data_obj obj;
$cast(obj, tr.tx_data_obj);
`uvm_info("xal2fb PPMSU monitoring", $sformatf("%m"), UVM_LOW)
monitor_xal2fb_pcie_order_check(obj);
endfunction: write_xal2fb_change
endclass : checker_subscriber
You should implement the pure virtual function void write(T t); which inherits from uvm_subscriber class in your checker_subscriber class.
Please refer to verification-methodology-reference
And assure your "write..." method's suffix matches the one you are using in macro declaration and then in the port declaration.
Okei, i'm quit new to C++/CLI so this should be an easy question.
I am trying to use a virtual method from an abstract class.
Here is my code:
// Figurer.h
#pragma once
using namespace System;
namespace Figurer {
public ref class Figur
{
public:
virtual double areal();
virtual double omkrets();
};
public ref class Sirkel : public Figur
{
private:
double radius;
double static PI = 3.141593;
public:
Sirkel(double sirkelradius){
radius = sirkelradius;
}
double areal(){
return radius * radius * PI;
}
};
}
Visual studio tells me: Error: 'new' or 'override' is required because this declaration matches function "Figurer::Figur::areal"
You posted the error message and the solution:
Error: 'new' or 'override' is required because this declaration matches function "Figurer::Figur::areal"
So you either need to use new or override in front of the function signature:
virtual double areal() override {
return radius * radius * PI;
}
See also: http://msdn.microsoft.com/en-us/library/41w3sh1c.aspx
I'm writing in c++ a graphic user interfaced program and I need to create a threads in the program.
so I'm using System::Threading namespace to get my goal.
The function that I want to use as thread is a class member function, so here is what I've done:
Server::Server() // constructor
{
System::Threading::Thread^ T = gcnew System::Threading::Thread(gcnew System::Threading::ThreadStart(this, this->RunServer)); // Server::RunServer
T->Start();
}
since it gave me those errors:
Error 2 error C3350: 'System::Threading::ThreadStart' : a delegate
constructor expects 2 argument(s)
Error 1 error C3867: 'Server::RunServer': function call missing
argument list; use '&Server::RunServer' to create a pointer to
member
I tried this call:
Server::Server() // constructor
{
System::Threading::Thread^ T = gcnew System::Threading::Thread(gcnew System::Threading::ThreadStart(&Server::RunServer));
T->Start();
}
and received this errors:
Error 1 error C3364: 'System::Threading::ThreadStart' : invalid
argument for delegate constructor; delegate target needs to be a
pointer to a member
function
2 IntelliSense: invalid delegate initializer -- function is not a
member of a managed
class
as far as I know the second try did not succeed because Server::RunServer doesn't have address, so it's like to do &1.
by the way I tried to use the ThreadStart to create thread of none class memeber function and it worked fine.
I'm using win7 - visual studio 2012. How to make it work?
EDIT:
Server declaration:
class Server
{
public:
/* Fields */
std::string Port;
std::string Host;
WSADATA wsaData;
int ListenResult;
SOCKET ListenSocket;
SOCKET* ClientSocket;
SOCKADDR_IN* ADDR;
int ADDRSize;
struct addrinfo *result;
struct addrinfo hints;
std::vector<Client> Clients;
/* Methods */
Server();
std::wstring StringW(char* String);
void Print(std::wstring String);
std::wstring CurrentTime();
void ParseServerIni();
void RunServer();
void PartToString(Part* _Part);
void InsertListItem(std::string String);
void ClientHandler(SOCKET* _Sock, SOCKADDR_IN* _ADDR);
int ParsePacket(Packet &_Packet, int _Bytes, Byte** _PacketBlock);
};
You almost got the syntax right.
Assuming the declaration is:
public ref class Server
{
void RunServer();
};
Then you should combine your two approaches, by specifying both the object to invoke the method on, and the address of the method, with the name of the declaring class.
gcnew System::Threading::ThreadStart(this, &Server::RunServer)
Here is my header file in Visual C++ Express 2010 (note the last line):
/* custom class header to communicate with LynxMotion robot arm */
using namespace System;
using namespace System::IO::Ports;
public ref class LynxRobotArm
{
public:
LynxRobotArm();
~LynxRobotArm();
void connectToSerialPort(String^ portName, int baudRate);
void disconnectFromSerialPort();
void setCurrentPosition(int channel, int position);
int getCurrentPosition(int channel);
void moveToPosition(int channel, int position);
private:
void initConnection();
SerialPort^ serialPort;
array<String^> ^serialPortNames;
String^ portName;
int baudRate;
std::vector<int> *currentPosition;
};
I try to assign a value to the vector by using this function;
void LynxRobotArm::setCurrentPosition(int channel, int position)
{
currentPosition[channel] = position;
}
The compiler gives me an error C2679:
binary '=' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
I looked up at MSDN and they say:
To use the operator, you must overload it for the specified type or define a conversion to a type for which the operator is defined.
I tried using currentPosition.at(channel) = position but it did not make a difference.
I am stuck... quite new to pointers, noted that using std::vector<int> currentPosition; instead of std::vector<int> *currentPosition; does not compile.
How should my set-function work? (will try getter afterwards..)
I am trying to call my static function using a separate thread, I have in my function something like this->listBox1->Items->Add(s);. The compiler shows that I can't use this inside a static function. I tried to make my function non-static (i.e remove static keyword) but when I did that, again the compiler shows two errors which are:
Error 2 error C3350: 'System::Threading::ThreadStart' : a delegate constructor expects 2 argument(s) c:\users\ahmed\documents\visual studio 2010\projects\testscan\testscan\Form1.h 116
Error 1 error C2276: '&' : illegal operation on bound member function expression c:\users\ahmed\documents\visual studio 2010\projects\testscan\testscan\Form1.h 116
Edit:
The function:
void ScanMyDir(String^ SourceDir)
{
array <String^> ^fileEntries = Directory::GetFiles(SourceDir);
for each (String^ fileName in fileEntries)
this->Form1->listBox1->Items->Add(fileName);
array<String^> ^SubDirEntries = Directory::GetDirectories(SourceDir);
for each (String^ subdir in SubDirEntries)
if ((File::GetAttributes(subdir) & FileAttributes::ReparsePoint)!= FileAttributes::ReparsePoint)
ScanMyDir(subdir);
}
Way to call it:
void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Thread ^thr1 = gcnew Thread(gcnew ParameterizedThreadStart(this,&Form1::ScanMyDir));
thr1->Start("c:\\");
}
Modification on Form load:
void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
System::Windows::Forms::Control::CheckForIllegalCrossThreadCalls = false;
}
The new errors :( :
Error 5 error C3352: 'void testScan::Form1::ScanMyDir(System::String ^)' : the specified function does not match the delegate type 'void (System::Object ^)' c:\users\ahmed\documents\visual studio 2010\projects\testscan\testscan\Form1.h 117
Error 1 error C2273: 'function-style cast' : illegal as right side of '->' operator c:\users\ahmed\documents\visual studio 2010\projects\testscan\testscan\Form1.h 105
Error 2 error C2227: left of '->listBox1' must point to class/struct/union/generic type c:\users\ahmed\documents\visual studio 2010\projects\testscan\testscan\Form1.h 105
Error 3 error C2227: left of '->Items' must point to class/struct/union/generic type c:\users\ahmed\documents\visual studio 2010\projects\testscan\testscan\Form1.h 105
Error 4 error C2227: left of '->Add' must point to class/struct/union/generic type c:\users\ahmed\documents\visual studio 2010\projects\testscan\testscan\Form1.h 105
No need to make your function static. Given errors are due to the wrong syntax you are using.
Assuming your form type as FormType,
void ScanMyDir()
{
//....
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
Thread ^thr1 =gcnew Thread(gcnew ThreadStart(this,&FormType::ScanMyDir));
thr1->Start();
}
If you insist on making it static, like #jgauffin said pass the form as an Object parameter to ScanMyDir() and then recast it to form in the function.
static void ScanMydir(Object ^ param)
{
FormType ^ ft = static_cast<FormType^>(param);
//..
ft->listBox1->Items->Add(fileName);
//..
}
In this case you have to use ParametrizedThreadStart()
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
Thread ^thr1 =gcnew Thread(gcnew ParametrizedThreadStart(&FormType::ScanMyDir));
// it is static no need for "this"
thr1->Start(this);
}
But at least make the ScanMyDir() function private and prevent outside access.
Now probably you will have another error, saying "you can not touch GUI with different threads", then on your forms loading function write
void FormType_Load(Object ^sender, EventArgs ^ e)
{
System::Windows::Forms::Control::CheckForIllegalCrossThreadCalls = false;
//....
}
But this may be dangerous depending on your implementation, you have to guarantee the thread-safety of listbox1->items.
Also listen to what the #Yochai Timmer guy said. He is telling good things.
Ok, basic principles:
Static means that the method is NOT a member of the object. It's a member of the Class type, and is in common to all the objects of that class. So, there's no this because there's no object associated.
Read the compiler errors. Read the function definitions to pass th right parameters...
When you get this working, you'll probably have an error because you're trying to use GUI function's from a different thread. That will cause run-time errors (sometimes).
Check this: UI Thread .Invoke() causing handle leak?
Disclaimer: I haven't used managed C++, only C# and vanilla C++. Therefore this answer might be incorrect.
ThreadStart delegate can take a parameter. Pass the instance of your class to it and cast it to your class in the static thread method. It's not this, but almost the same thing.