• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Custom Scripts compile error

Status
Not open for further replies.

katos

Noble Member
Hey guys,

Having an error in the compile of custom scripts, not sure what is going on... I have tried my best to fix errors myself with my friend Agger, but I am rather stumped by this one...

Error:
Code:
../game/libgame.a(ScriptLoader.cpp.o): In function `AddScripts()':
ScriptLoader.cpp:(.text+0xe06): undefined reference to `AddSC_Professions_NPC()'
ScriptLoader.cpp:(.text+0xe0b): undefined reference to `AddSC_stationery_add_create()'
ScriptLoader.cpp:(.text+0xe11): undefined reference to `AddSC_Snowman_Helper()'
../game/libgame.a(ScriptLoader.cpp.o): In function `AddCustomScripts()':
ScriptLoader.cpp:(.text+0xea5): undefined reference to `AddSC_Professions_NPC()'
ScriptLoader.cpp:(.text+0xeaa): undefined reference to `AddSC_stationery_add_create()'
ScriptLoader.cpp:(.text+0xeaf): undefined reference to `AddSC_Snowman_Helper()'
../game/libgame.a(ScriptLoader.cpp.o): In function `AddScripts()':
ScriptLoader.cpp:(.text+0xe1a): undefined reference to `AddSC_TitleNpc()'
../game/libgame.a(ScriptLoader.cpp.o): In function `AddCustomScripts()':
ScriptLoader.cpp:(.text+0xeb8): undefined reference to `AddSC_TitleNpc()'
collect2: ld returned 1 exit status
make[2]: *** [src/server/worldserver/worldserver] Error 1
make[1]: *** [src/server/worldserver/CMakeFiles/worldserver.dir/all] Error 2
make: *** [all] Error 2

Scriptloader.cpp:

Code:
#ifdef SCRIPTS
/* This is where custom scripts' loading functions should be declared. */
void AddSC_Professions_NPC();
void AddSC_stationery_add_create();
void AddSC_Snowman_Helper();
void AddSC_The_Grinch();
void AddSC_TitleNpc();
#endif

void AddCustomScripts()
{
#ifdef SCRIPTS
    /* This is where custom scripts should be added. */
AddSC_Professions_NPC();
AddSC_stationery_add_create();
AddSC_Snowman_Helper();
AddSC_The_Grinch();
AddSC_TitleNpc();
#endif
}

Thanks for any help,
Katos

- - - Updated - - -

PS: Please note that this is running on linux - ubuntu
 
Last edited:

katos

Noble Member
[MENTION=2]Faded[/MENTION] - Yes, sorry should have mentioned this.
[MENTION=39]Neth[/MENTION] - Yes, I will post this now:

set(scripts_STAT_SRCS
${scripts_STAT_SRCS}

Custom/blizz_stationery.cpp
Custom/profession_NPC.cpp
Custom/Snowman_Helper.cpp
Custom/TitleNpc.cpp

)

message("-> Prepared: Custom")
 

Hyperion

Founder
Did you run a new CMake and then rebuild?

It always helps to run cmake once after adding the first custom script, then you won't have to do it anymore.
 

katos

Noble Member
I did, I believe... Unless this is wrong?:

cmake ../ -DPREFIX=/home/`echo $USER`/server

I appologise if this seems unbelievably newbish. I am actually reasonably new to Linux compiles :p
 

Hyperion

Founder
try doing(as the user):

mkdir /home/user/build && cd /home/user/build && cmake ../TrinityCore -DPREFIX=/home/user/server

just change 'user' with the username you're using. Don't use the $user variable.
 

katos

Noble Member
[MENTION=2]Faded[/MENTION] Thank you, will try this and get back to you

- - - Updated - - -

Tried it, got this error:
CMake Error: The source directory "/home/vexation/TrinityCore/TrinityCore" does not exist.

My mistake sorry, I totally forgot that the trinitycore is actually in:

/home/vexation/TrinityCore/build

My appologies Faded!
 

Hyperion

Founder
[MENTION=2]Faded[/MENTION] Thank you, will try this and get back to you

- - - Updated - - -

Tried it, got this error:
CMake Error: The source directory "/home/vexation/TrinityCore/TrinityCore" does not exist.

My mistake sorry, I totally forgot that the trinitycore is actually in:

/home/vexation/TrinityCore/build

My appologies Faded!

It's actually my bad, I didn't mean to put ../TrinityCore in the cmake just ../

Why is trinitycore in trinitycore/build? Is that where you have the source or build?
 

Hyperion

Founder
The build, Faded.

I basically have:

/home/vexation/TrinityCore/
in here:


In build:


This help?

Should I redo the cmake with just ../ ??

Okay. I assume your scripts and scriptloader, and cmake files are added and edited in /home/vexation/TrinityCore/

Now, cd /home/vexation/build

then

cmake ../ -DPREFIX=/home/vexation/server

Ignore /home/vexation/TrinityCore/build entirely
 

katos

Noble Member
[MENTION=2]Faded[/MENTION]

Ok, the Cmake was successful (presuming you meant cd /home/vexation/TrinityCore/build)

All errors are gone, I owe you massively Faded. You're just too good!
 

Hyperion

Founder
[MENTION=2]Faded[/MENTION]

Ok, the Cmake was successful (presuming you meant cd /home/vexation/TrinityCore/build)

All errors are gone, I owe you massively Faded. You're just too good!

You're welcome ;)

If you add more scripts, you still add everything the same way but you don't have to cmake anymore, just rebuild.
 
Status
Not open for further replies.
Top