Aller au contenu

Photo

Problems compiling sys_chargen_h


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Wadders02

Wadders02
  • Members
  • 2 messages
I've been trying to make a new class but am having issues getting sys_chargen_h to compile. I've tried restoring the file to its original state but continue to get the same error.

sys_chargen_h.nss - sys_chargen_h.nss(?): Script must contain either a main or StartingConditional

#2
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages
Don't worry, that's because that kind of script is thought to be included (#include "my_file_h") in other scripts that should have a main() or StartingConditional() function.

For example, try to compile wrappers_h and you'll get the same error.

That's what is known as a header file in C++ and you know it because the name of the script ends with "_h". That "h" is for "header". This is not a rule, it is just to make easier to know how to use a script file just reading its name. You can obviously include any script dispite of its name. The only restriction is that the included script should not repeat any function, variable or constant declaration. That's why header scripts don't have a main() function.

To compile it, just add a new line with the missing function:

void main() {}

Compile it and after that comment or remove that line.

Modifié par _L_o_B_o_, 01 septembre 2010 - 02:56 .


#3
FergusM

FergusM
  • Members
  • 460 messages
To further explain, what happens is that any script which includes a header file basically gets the text pasted in when you compile that script. So, for example, I believe there is a sys_chargen.nss, which includes sys_chargen_h.nss - when you compile the former, the latter will be inserted into it. This means that any time you change a header file, you must recompile all scripts that include it. So for something that is a core game system like this, you might want to select a bunch of core script folders and export them all to be safe.

#4
Wadders02

Wadders02
  • Members
  • 2 messages
Thanks for the help