tags:

views:

570

answers:

2

I cannot get wxErlang to work at all. Do i need to include a module. Can't find any basic information relating to it. Please help. I am look for a very basic example of a module.

the error I am getting is

undefined function wx:start/0

+3  A: 

This should display an empty frame:

1> wx:new().
{wx_ref,0,wx,[]}

2> Frame = wxFrame:new(wx:null(), 0, "myFrame").
{wx_ref,36,wxFrame,[]}

3> wxFrame:show(Frame).
true
Zed
OK I am getting "bad function wx:new()." i am guessing I am missing a library. How do I go about solving that?
Damian
Are you using R13? Did you compile with wx support?I think the library dependencies are: freeglut3-dev and libwxgtk2.8-dev
Zed
You must also enable SMP support for wx.
Zed
unfortunatly atm i am on a windows box. I have just searched through the erl/lib directory and did not find wxerlang. I have now downloaded the latest release of erlang and seems that I now have the wxerlang lib. I have another problem now, but I will look into it before posting another question.
Damian
I have plucked the following code from some tutorial but I think it must be very old could you confirm this and point me in the right direction if possible.-module(test).-export([start/0]).start() -> wx:start(), XRC = wx:xml_resource_get(), wx:init_all_handlers(XRC), wx:load(XRC, "gui.xrc"), Frame = wx:load_frame(XRC, ?NULL, "frame_1"), wx:show(Frame).
Damian
sorry about the fomatting!
Damian
I think that is for an old version of wxerlang.sourceforge.net
Zed
I have the standard install of erl 5.7.1 on Windows and Zed's script above certainly shows a window. I did no builds - simply downloaded the standard windows install...
Alan Moore
M:\>"c:\Program Files\erl5.7.1\bin\erl.exe"Eshell V5.7.1 (abort with ^G)1> wx:new().{wx_ref,0,wx,[]}2> Frame = wxFrame:new(wx:null(), 0, "myFrame").{wx_ref,35,wxFrame,[]}3> wxFrame:show(Frame).true4>
Alan Moore
Your erlang install should have a lib\wx-VER\examples directory containing some examples
Zed
A: 

I just needed to include the wx lib using the following line

-include_lib("include/wx.hrl").

include/ is a sub directory in my project containing the wx library.

Damian
Note: It should be: -include_lib("wx/include/wx.hrl"). Right?
Mazen Harake
I am on a windows box and have setup my application on a different drive. I added and include directory and placed the wx files in that, so it works in my situation.
Damian