• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Server] HELP Me 4 Waring undefined symbol "signLabels"
#1
ERROR
D:\caybienbao (1).pwn(25) : error 017: undefined symbol "signLabels"
D:\caybienbao (1).pwn(25) : warning 215: expression has no effect
D:\caybienbao (1).pwn(25) : error 001: expected token: ";", but found "]"
D:\caybienbao (1).pwn(25) : error 029: invalid expression, assumed zero
D:\caybienbao (1).pwn(25) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.





public OnGameModeInit()
{
    for (new i = 0; i < MAX_SIGNS_ADMIN; i++)
    {
        signLabels[i] = INVALID_TEXT_LABEL; // Kh?i t?o giá tr? bi?n báo không h?p l?
    }

    // Kiem tra gia tri cua mang signPositions
    if (signPositions[0][0] == 0.0 || signPositions[0][1] == 0.0 || signPositions[0][2] == 0.0)
    {
        printf("error: invalid float values!");
        return 0; // Dang lai neu gia tri khôong hop le
    }

    return 1;
}
  Reply
#2
The warning "warning 215: expression has no effect" means that the compiler has detected an expression that has no impact on the execution of the program. This often happens when a line of code performs no concrete action, such as assigning a value or calling a function.



In your code, this error might occur if the compiler doesn’t correctly recognize certain values or if you have a poorly formed expression.



To identify and fix this warning, here are a few checks you can perform:
  • Check the value of "INVALID_TEXT_LABEL" : "If INVALID_TEXT_LABEL" is not defined, or if it is incorrectly defined, this could cause the warning.
  • Ensure all expressions are correct: Sometimes, a poorly written expression or incorrect use of an operator can trigger this warning.


Here are some suggestions:
  • Make sure "INVALID_TEXT_LABEL" is properly defined, for example:
Code:
#define INVALID_TEXT_LABEL -1 // or another appropriate value


  • Make sure your for loop has an expression that has an effect, such as initializing an array.


Here’s an example:

Code:
#define MAX_SIGNS_ADMIN 10
#define INVALID_TEXT_LABEL -1 // Ensure this constant is correctly defined

new signLabels[MAX_SIGNS_ADMIN];
new Float:signPositions[MAX_SIGNS_ADMIN][3];

public OnGameModeInit()
{
    for (new i = 0; i < MAX_SIGNS_ADMIN; i++)
    {
        signLabels[i] = INVALID_TEXT_LABEL; // Ensure this assignment is valid
    }

    if (signPositions[0][0] == 0.0 || signPositions[0][1] == 0.0 || signPositions[0][2] == 0.0)
    {
        printf("error: invalid float values!");
        return 0;
    }

    return 1;
}
  Reply


Forum Jump: