How to build Hello World example with Livecode 5.0.2

Are you developing an External using the LiveCode Externals SDK?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
emdalton
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 152
Joined: Thu Jul 30, 2009 4:03 am

How to build Hello World example with Livecode 5.0.2

Post by emdalton » Sun Feb 26, 2012 9:45 pm

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.
Elizabeth

Image

trevix
Posts: 957
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: How to build Hello World example with Livecode 5.0.2

Post by trevix » Wed Feb 29, 2012 11:56 am

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
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 957
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: How to build Hello World example with Livecode 5.0.2

Post by trevix » Wed Feb 29, 2012 12:19 pm

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
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

emdalton
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 152
Joined: Thu Jul 30, 2009 4:03 am

Re: How to build Hello World example with Livecode 5.0.2

Post by emdalton » Wed Feb 29, 2012 6:04 pm

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.
Elizabeth

Image

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: How to build Hello World example with Livecode 5.0.2

Post by mwieder » Wed Feb 29, 2012 6:22 pm

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.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: How to build Hello World example with Livecode 5.0.2

Post by mwieder » Wed Feb 29, 2012 6:26 pm

...and yes... I agree the article on the web should be updated/corrected.

emdalton
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 152
Joined: Thu Jul 30, 2009 4:03 am

Re: How to build Hello World example with Livecode 5.0.2

Post by emdalton » Thu Mar 01, 2012 6:59 pm

Thanks. I've never used the Visual series of IDEs before, so I really am just feeling my way around. :?
Elizabeth

Image

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: How to build Hello World example with Livecode 5.0.2

Post by mwieder » Thu Mar 01, 2012 7:16 pm

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.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: How to build Hello World example with Livecode 5.0.2

Post by sturgis » Thu Mar 15, 2012 1:40 am

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

Post Reply

Return to “Building Externals”