Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I get error 021 using y_hooks #693

Open
daniscript18 opened this issue Nov 18, 2024 · 1 comment
Open

I get error 021 using y_hooks #693

daniscript18 opened this issue Nov 18, 2024 · 1 comment

Comments

@daniscript18
Copy link

Pawn compiler 3.10.10                   Copyright (c) 1997-2006, ITB CompuPhase

Modules/Worlds/Code.pwn(3) : error 021: symbol already defined: "_@yHOnDialogResponse@000"
Modules/Worlds/Code.pwn(3) : error 021: symbol already defined: "@yH_OnDialogResponse@000"
Modules/Worlds/Code.pwn(3) : error 021: symbol already defined: "@yH_OnDialogResponse@000"
Modules/Worlds/Code.pwn(3) : fatal error 107: too many error messages on one line

Compilation aborted.

I am developing a modular code that requires quite a few files, I wanted to simplify things further by using y_hooks since after reading the documentation I knew that was what I needed.

However I'm getting these errors, I've searched for information on some forums and in the y_hooks documentation, I've tried everything I can but this is the first time I've developed modular code of this style and used y_hooks on this scale, so I really don't know what I'm doing wrong.

I preferred to share this code where I replicate the problem so as not to extend myself so much talking.

  • gamemodes/GM.pwn (Main file)
#include <a_samp>

#include "Modules/Codes.pwn"

main() {
    return true;
}
  • gamemodes/Modules/Codes.pwn
#include "Modules/Users/Code.pwn"
#include "Modules/Worlds/Code.pwn"
  • gamemodes/Modules/Users/Code.pwn
#include <YSI_Coding/y_hooks>

hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    return true;
}
  • gamemodes/Modules/Worlds/Code.pwn
#include <YSI_Coding/y_hooks>

hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    return true;
}
  • I tried including y_hooks at the end of all Code.pwn files.
  • I tried including y_hooks only in the main file after including Codes.pwn.
  • I tried including y_hooks in Codes.pwn and in all Code.pwn files (at the end and at the beginning of the files)
  • I tried including y_hooks only in Codes.pwn (at the end and at the beginning of the file).

I think I also tried other ways of including y_hooks but it took me a few hours until I gave up and decided to turn to you guys... I hope you can help me solve the problem and I will appreciate if I can figure this out and learn more about y_hooks.

@daniscript18
Copy link
Author

My temporary solution has been this...

  • gamemodes/GM.pwn (Main file)
#include <a_samp>

#include "Modules/Codes.pwn"

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    OnDialogResponse_Users(playerid, dialogid, response, listitem, inputtext);
    OnDialogResponse_Worlds(playerid, dialogid, response, listitem, inputtext);
    return true;
}

main() {
    return true;
}
  • gamemodes/Modules/Codes.pwn
#include "Modules/Users/Code.pwn"
#include "Modules/Worlds/Code.pwn"
  • gamemodes/Modules/Users/Code.pwn
OnDialogResponse_Users(playerid, dialogid, response, listitem, inputtext[]) {
    return true;
}
  • gamemodes/Modules/Worlds/Code.pwn
OnDialogResponse_Worlds(playerid, dialogid, response, listitem, inputtext[]) {
    return true;
}

But it's clearly a temporary solution, I'm still not sure if I'm using y_hooks incorrectly or just what I'm trying to do can't be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant