Unresolved import with struct (SOLVED)

Started by Ishmael, Tue 01/02/2005 08:04:06

Previous topic - Next topic

Ishmael

I'm not sure what is wrong here, but after a lot of moving these things around I got my game to compile. But:

Script link failed: runtime error: unresolved import 'plrst'

(or something very close) When I run the game exe.

I put alike in the script header:

struct playerstat {
  int health;
  int money;
  int exp;
  int weapon;
  int armour;
};

import playerstat plrst;


I just can't figure this out by myself... I'm not a C coder or anything, so I've put that up based on what I've seen elsewhere.

I'd greatly appriciate if someone told me how to get rid of that error.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Gilbert

Hmmmm how did you declare plrst in the global script? Like this?

playerstat plrst;
export plrst;

Ishmael

eeer... I was soo sure I had forgotten something... thanks.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Gilbert

While we're a bit on topic, just some thing to ask CJ. In the manual, about the keyword export:
Quote
You must place this at the end of your global script.
I'm now a bit confused, as I never noticed that until now, is it really necessary to put the export at the end of the script?
I'd always used export immediately after the variable declarations and never got any problem.
So, how did the compiler work? Is it really okay to just make sure the exports were after the declarations, no need to put them at the end of the script? Or are there any real reasons it's more advisable to put them at the end?

Personally it's more clear if I can export them immediately after their declarations, this even makes codes more readible as you can find out which variables are indeed used globally immediately without the help of comments.

Pumaman

Quote from: Gilbot V7000a on Tue 01/02/2005 08:25:38
While we're a bit on topic, just some thing to ask CJ. In the manual, about the keyword export:
Quote
You must place this at the end of your global script.

This just means that you have to place the export after the variable's declaration, but saying "at the end" is just an easy way to clear up and possible confusion about it.

Gilbert

Thank you for your explanations!

* Gilbot V7000a feels relieved as he doesn't need to do the "hard" Copying & Pasting task. :=

SMF spam blocked by CleanTalk