Page 1 of 1

How to build Hello World example with Livecode 5.0.2

Posted: Sun Feb 26, 2012 9:45 pm
by emdalton
I attempted to build the "hello world" example from the newsletter articles in Livecode 5.0.2 on Windows 7 using Microsoft Visual C++ 2010 Express. Quite a few steps seem to have changed from the time the article was written. I thought it would be helpful to document the steps I needed to take to make it work.

Downloaded the sample files, followed the directions in the tutorial here:

http://revmedia.runrev.com/developers/l ... ls-part-1/

"External Creator V3.rev" still works, but opening "rnahello.vcproj" generates messages saying the project needs to be converted. I did that. Then I added the initial source code examples. The #include statements in the tutorial are blank in the tutorial, so I used the following:

#include <cstdlib>
#include <cstdio>
#include <cstring>

I corrected this:
#include <revolution/external.h>
to this:
#include <C:\Users\zigraphix\Documents\livecode\ExternalsEnvironmentV3\libexternal\src\external.h>

I also needed to make changes in the environment in VisualC++ to launch Livecode, rather than trying to launch the dll directly:
livecode_external_config.png
Clicked the Debug green triangle, got this:
debugging.png
Clicked yes. Livecode launched. Made edits to rnahellotest as described in tutorial. Also needed to manually add dll to stack:
externals.png
Once I had completed these steps, I was able to put some text in the "Name" field and click the button, and get a popup with "Hello, *" where * is the content typed into the Name field.

I hope this helps someone.

Re: How to build Hello World example with Livecode 5.0.2

Posted: Wed Feb 29, 2012 11:56 am
by trevix
Hi and thanks (isn't about time that RunRev update the article to LiveCode 4.6 ?)

When you say:
...I also needed to make changes in the environment in VisualC++ to launch Livecode, rather than trying to launch the dll directly:..
In the picture it is hard to see what the "command argument" has to points to..
Can you explain ?
Thanks
Trevix

Re: How to build Hello World example with Livecode 5.0.2

Posted: Wed Feb 29, 2012 12:19 pm
by trevix
Also...when I press the Debug green triangle, I've got this error (translated from italian) from Visual Express C++ 2010:

Impossible to start the application 'C:\Documents and Settings\userName\....\ExternalsEnvironmentV3\_build\Debug\libexternal.lib'
The binary format of the file is not reconized or supported.

I'm using LiveCode 4.6.4

Thansk
Trevix

Re: How to build Hello World example with Livecode 5.0.2

Posted: Wed Feb 29, 2012 6:04 pm
by emdalton
trevix wrote:Hi and thanks (isn't about time that RunRev update the article to LiveCode 4.6 ?)

When you say:
...I also needed to make changes in the environment in VisualC++ to launch Livecode, rather than trying to launch the dll directly:..
In the picture it is hard to see what the "command argument" has to points to..
Can you explain ?
Thanks
Trevix
You can click the picture to get a full-size view. I think this is the cause of your other error, too. When you click the Debug triangle, Visual C++ will try to launch a program. If you don't tell it otherwise, it will try to launch your compiled dll or the library or whatever directly, which won't work. You need to tell it to launch Livecode.

Re: How to build Hello World example with Livecode 5.0.2

Posted: Wed Feb 29, 2012 6:22 pm
by mwieder
Elizabeth-

Rather than hardcodethe path to the external.h header file, it's probably better to edit the project settings and add the path to the folder ("C:\Users\zigraphix\Documents\livecode\ExternalsEnvironmentV3\libexternal") to the place to look for include files (it's not in front of me right now, so I don't have the exact name). That way the project is more portable, or at least the source files are.

Re: How to build Hello World example with Livecode 5.0.2

Posted: Wed Feb 29, 2012 6:26 pm
by mwieder
...and yes... I agree the article on the web should be updated/corrected.

Re: How to build Hello World example with Livecode 5.0.2

Posted: Thu Mar 01, 2012 6:59 pm
by emdalton
Thanks. I've never used the Visual series of IDEs before, so I really am just feeling my way around. :?

Re: How to build Hello World example with Livecode 5.0.2

Posted: Thu Mar 01, 2012 7:16 pm
by mwieder
Yeah - it's a bit... er... quirky. Nothing's easy to find. Basically, once I got a project that created a proper external dll I saved off a generic copy of it and use that to start any new external project. Otherwise I have to try to fiddle with things and find out what settings need to be tweaked and it's a pita.

Re: How to build Hello World example with Livecode 5.0.2

Posted: Thu Mar 15, 2012 1:40 am
by sturgis
Chances are that libExternal is set as the startup project. (it will be the hilited IE dark entry in the list on the left) To fix this, right click on your project, and choose set as startup project.

And ty ty ty edmalton! Got it to work thx to your direction.
trevix wrote:Also...when I press the Debug green triangle, I've got this error (translated from italian) from Visual Express C++ 2010:

Impossible to start the application 'C:\Documents and Settings\userName\....\ExternalsEnvironmentV3\_build\Debug\libexternal.lib'
The binary format of the file is not reconized or supported.

I'm using LiveCode 4.6.4

Thansk
Trevix